class Hawkular::Metrics::Client::Gauges

Class that interacts with “gauge” metric types

Public Class Methods

new(client) click to toggle source

@param client [Client]

Calls superclass method Hawkular::Metrics::Client::Metrics::new
    # File lib/hawkular/metrics/metric_api.rb
255 def initialize(client)
256   super(client, 'gauge', 'gauges')
257 end

Public Instance Methods

get_periods(id, starts: nil, ends: nil, threshold: nil, operation: nil) click to toggle source

Retrieve time ranges when given gauge matches given operation and threshold @param id [String] gauge ID @param starts [Integer] timestamp (default now - 8h) @param ends [Integer] timestamp (default now) @param threshold [Numeric] @param operation [String] A comparison operation to perform between values and the

threshold. Supported operations include "ge", "gte", "lt", "lte", and "eq"

@example Get time periods when metric “gauge1” was under 10 in past 4 hours

before4h = client.now - (4 * 60 * 60 * 1000)
client.gauges.get_periods("gauge1", starts: before4h, threshold: 10, operation: "lte")
    # File lib/hawkular/metrics/metric_api.rb
269 def get_periods(id, starts: nil, ends: nil, threshold: nil, operation: nil)
270   params = { start: starts, end: ends, threshold: threshold, op: operation }
271   @client.http_get("/#{@resource}/#{ERB::Util.url_encode(id)}/periods?" + encode_params(params))
272 end