Class: Wavefront::Metric

Inherits:
Base
  • Object
show all
Defined in:
lib/wavefront-sdk/metric.rb

Overview

Query Wavefront metrics.

Instance Attribute Summary

Attributes inherited from Base

#conn, #debug, #logger, #net, #noop, #opts, #update_keys, #verbose

Instance Method Summary collapse

Methods inherited from Base

#api_delete, #api_get, #api_post, #api_put, #hash_for_update, #initialize, #log, #mk_conn, #respond, #time_to_ms

Methods included from Mixins

#parse_time

Methods included from Validators

#wf_alert_id?, #wf_alert_severity?, #wf_cloudintegration_id?, #wf_dashboard_id?, #wf_epoch?, #wf_event_id?, #wf_granularity?, #wf_link_id?, #wf_link_template?, #wf_maintenance_window_id?, #wf_message_id?, #wf_metric_name?, #wf_ms_ts?, #wf_name?, #wf_point?, #wf_point_tags?, #wf_proxy_id?, #wf_savedsearch_entity?, #wf_savedsearch_id?, #wf_source_id?, #wf_string?, #wf_tag?, #wf_ts?, #wf_user_id?, #wf_value?, #wf_version?, #wf_webhook_id?

Constructor Details

This class inherits a constructor from Wavefront::Base

Instance Method Details

#api_baseObject



8
9
10
# File 'lib/wavefront-sdk/metric.rb', line 8

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

Raises:

  • (ArgumentError)


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

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

  q = [[:m, metric]]

  if cursor
    raise ArgumentError unless cursor.is_a?(String)
    q.<< [:c, cursor]
  end

  sources.each { |s| q.<< [:h, s] }

  api_get('detail', q)
end