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

Inherits:
CadvisorClient 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 CadvisorClient

#get, #update_query

Methods inherited from Prometheus::ApiClient::Client

#faraday_headers, #faraday_options, #faraday_proxy, #faraday_request, #faraday_ssl, #get, #label, #query, #query_range, #run_command, #targets

Constructor Details

#initialize(options = {}) ⇒ Pod

Returns a new instance of Pod.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/prometheus/api_client/cadvisor.rb', line 53

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

  # if no pod_name is given, assume we want data on all pods
  @labels = if pod_name
              'job="kubernetes-cadvisor",container_name="POD",' \
              "pod_name=\"#{pod_name}\",namespace=\"#{namespace}\""
            else
              'job="kubernetes-cadvisor",container_name="POD"'
            end

  super(options)
end