Class: Wavefront::Metric

Inherits:
CoreApi show all
Defined in:
lib/wavefront-sdk/metric.rb

Overview

Query Wavefront metrics.

Instance Attribute Summary

Attributes inherited from CoreApi

#api, #creds, #logger, #opts, #update_keys

Instance Method Summary collapse

Methods inherited from CoreApi

#api_path, #hash_for_update, #initialize, #setup_api, #time_to_ms

Methods included from Mixins

#log, #parse_relative_time, #parse_time, #relative_time, #time_multiplier, #valid_relative_time?

Methods included from Validators

#uuid?, #wf_account_id?, #wf_alert_id?, #wf_alert_severity?, #wf_apitoken_id?, #wf_aws_external_id?, #wf_cloudintegration_id?, #wf_dashboard_id?, #wf_derivedmetric_id?, #wf_distribution?, #wf_distribution_count?, #wf_distribution_interval?, #wf_distribution_values?, #wf_epoch?, #wf_event_id?, #wf_granularity?, #wf_ingestionpolicy_id?, #wf_integration_id?, #wf_link_id?, #wf_link_template?, #wf_maintenance_window_id?, #wf_message_id?, #wf_metric_name?, #wf_metricspolicy_id?, #wf_monitoredapplication_id?, #wf_monitoredcluster_id?, #wf_ms_ts?, #wf_name?, #wf_notificant_id?, #wf_permission?, #wf_point?, #wf_point_tag?, #wf_point_tags?, #wf_proxy_id?, #wf_role_id?, #wf_sampling_value?, #wf_savedsearch_entity?, #wf_savedsearch_id?, #wf_serviceaccount_id?, #wf_source_id?, #wf_spansamplingpolicy_id?, #wf_string?, #wf_tag?, #wf_trace?, #wf_ts?, #wf_user_id?, #wf_usergroup_id?, #wf_value?, #wf_version?, #wf_webhook_id?

Constructor Details

This class inherits a constructor from Wavefront::CoreApi

Instance Method Details

#api_baseObject



10
11
12
# File 'lib/wavefront-sdk/metric.rb', line 10

def api_base
  'chart/metric'
end

#detail(metric, sources = [], cursor = nil) ⇒ Object

GET /api/v2/chart/metric/detail Get more details on a metric, including reporting sources and approximate last time reported

Parameters:

  • metric (String)

    the metric to fetch

  • sources (Array[String]) (defaults to: [])

    a list of sources to check.

  • cursor (String) (defaults to: nil)

    optionally begin from this result

Raises:

  • (ArgumentError)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/wavefront-sdk/metric.rb', line 22

def detail(metric, sources = [], cursor = nil)
  raise ArgumentError unless metric.is_a?(String) && sources.is_a?(Array)

  query = [[:m, metric]]

  if cursor
    raise ArgumentError unless cursor.is_a?(String)

    query << [:c, cursor]
  end

  sources.each { |source| query << [:h, source] }

  api.get('detail', query)
end