Class: Hawkular::Metrics::Client::Counters
- Defined in:
- lib/hawkular/metrics/metric_api.rb
Overview
Class that interacts with “counter” metric types
Instance Method Summary collapse
-
#get_rate(id, starts: nil, ends: nil, bucket_duration: nil) ⇒ Array[Hash]
Retrieve metric rate points.
-
#initialize(client) ⇒ Counters
constructor
A new instance of Counters.
Methods inherited from Metrics
#create, #encode_params, #get, #get_data, #get_data_by_tags, #push_data, #query, #raw_data, #update_tags
Constructor Details
#initialize(client) ⇒ Counters
Returns a new instance of Counters
271 272 273 |
# File 'lib/hawkular/metrics/metric_api.rb', line 271 def initialize(client) super(client, 'counter', 'counters') end |
Instance Method Details
#get_rate(id, starts: nil, ends: nil, bucket_duration: nil) ⇒ Array[Hash]
Retrieve metric rate points
282 283 284 285 286 287 288 289 |
# File 'lib/hawkular/metrics/metric_api.rb', line 282 def get_rate(id, starts: nil, ends: nil, bucket_duration: nil) path = "/#{@resource}/#{ERB::Util.url_encode(id)}/rate" path << '/stats' unless bucket_duration.nil? || @legacy_api params = { start: starts, end: ends, bucketDuration: bucket_duration } resp = @client.http_get(path + '?' + encode_params(params)) # API returns no content (empty Hash) instead of empty array resp.is_a?(Array) ? resp : [] end |