Class: Prometheus::ApiClient::Cadvisor::Node

Inherits:
Prometheus::ApiClient::Client show all
Defined in:
lib/prometheus/api_client/cadvisor.rb

Overview

Create a Prometheus API client:

A default client is created if options is omitted.

Constant Summary

Constants inherited from Prometheus::ApiClient::Client

Prometheus::ApiClient::Client::DEFAULT_ARGS

Instance Method Summary collapse

Methods inherited from Prometheus::ApiClient::Client

#faraday_headers, #faraday_options, #faraday_proxy, #faraday_verify_ssl, #get, #label, #run_command, #targets, #update_query

Constructor Details

#initialize(options = {}) ⇒ Node

Returns a new instance of Node.



23
24
25
26
27
28
29
# File 'lib/prometheus/api_client/cadvisor.rb', line 23

def initialize(options = {})
  instance = options[:instance]

  @labels = "job=\"kubernetes-cadvisor\",instance=\"#{instance}\"," \
    'id="/"'
  super(options)
end

Instance Method Details

#query(options) ⇒ Object



31
32
33
34
# File 'lib/prometheus/api_client/cadvisor.rb', line 31

def query(options)
  options[:query] = update_query(options[:query], @labels)
  super(options)
end

#query_range(options) ⇒ Object



36
37
38
39
# File 'lib/prometheus/api_client/cadvisor.rb', line 36

def query_range(options)
  options[:query] = update_query(options[:query], @labels)
  super(options)
end