module Zeus::MetricsInterface

Interface for dealing with metrics api calls

Public Instance Methods

delete_metrics(name) click to toggle source

delete metrics @param [String] name a target metrics name @return [Zeus::APIClient::Result]

# File lib/zeus/api_client/metrics_interface.rb, line 80
def delete_metrics(name)
  response = delete("/metrics/#{@access_token}/#{name}/")
  Result.new(response)
end
get_metrics(options = {}) click to toggle source

Get metrics @param [Hash] options can contain:

@param [String] regex a factor for filtering by metrics name
@param [String] from_date a factor for filtering by start timestamp
@param [String] to_date a factor for filtering by end timestamp
@param [String] aggregator an aggregation methods
@param [String] group_interval grouping values by time interval.
                For example, 1000s, 100m, 10h, 1d , 1w
@param [String] filter_condition filters to be applied to metric values.
                eg: "column1 > 0", "column1 > 50 AND column2 = 10"
@param [Integer] limit a maximum number of returning values

@return [Zeus::APIClient::Result]

# File lib/zeus/api_client/metrics_interface.rb, line 70
def get_metrics(options = {})
  response = get("/metrics/#{@access_token}/_values/", options)
  Result.new(response)
rescue => e
  Result.new(e.response)
end
list_metrics(options = {}) click to toggle source

Get metrics list @param [Hash] options can contain:

@param [String] regex a factor for filtering by metrics name.
                eg: metric.name, metric.name*, metric.name.* etc.
@param [String] from_date a factor for filtering by start timestamp
@param [String] to_date a factor for filtering by end timestamp
@param [String] aggregator an aggregation methods
@param [String] group_interval grouping values by time interval.
                For example, 1000s, 100m, 10h, 1d , 1w
@param [String] filter_condition a factor for filtering by metrics name
@param [String] limit a maximum number of returning values

@return [Zeus::APIClient::Result]

# File lib/zeus/api_client/metrics_interface.rb, line 36
def list_metrics(options = {})
  response = get("/metrics/#{@access_token}/_names/", options)
  Result.new(response)
rescue => e
  Result.new(e.response)
end
send_metrics(name, metrics) click to toggle source

Send metrics list @param [String] name a name of metrics.

For example, metric.name, metric.name*, metric.name.* etc.

@param [Array] metrics a list of hash objects @return [Zeus::APIClient::Result]

# File lib/zeus/api_client/metrics_interface.rb, line 48
def send_metrics(name, metrics)
  params = { metrics: metrics }
  begin
    response = post("/metrics/#{@access_token}/#{name}/", params)
    Result.new(response)
  rescue => e
    Result.new(e.response)
  end
end