Class: Prometheus::ApiClient::Cadvisor::Pod

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

Overview

A client with special labels for pod cadvisor metrics

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 = {}) ⇒ Pod

Returns a new instance of Pod.



44
45
46
47
48
49
50
51
# File 'lib/prometheus/api_client/cadvisor.rb', line 44

def initialize(options = {})
  pod_name = options[:pod_name]
  namespace = options[:namespace] || 'default'

  @labels = "job=\"kubernetes-cadvisor\",namespace=\"#{namespace}\"," \
    "pod_name=\"#{pod_name}\",container_name=\"POD\""
  super(options)
end

Instance Method Details

#query(options) ⇒ Object



53
54
55
56
# File 'lib/prometheus/api_client/cadvisor.rb', line 53

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

#query_range(options) ⇒ Object



58
59
60
61
# File 'lib/prometheus/api_client/cadvisor.rb', line 58

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