Skip to content

Commit 3489f10

Browse files
committed
enable 1.9 support
1 parent 4e080d3 commit 3489f10

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

lib/prometheus/api_client/cadvisor.rb

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@ module Cadvisor
2020
#
2121
# A default client is created if options is omitted.
2222
class Node < Client
23-
def initialize(**options)
23+
def initialize(options = {})
2424
instance = options[:instance]
25-
region = options[:region] || 'infra'
26-
zone = options[:zone] || 'default'
2725

28-
@labels = "job=\"kubernetes-cadvisor\",region=\"#{region}\"," \
29-
"zone=\"#{zone}\",instance=\"#{instance}\""
26+
@labels = "job=\"kubernetes-cadvisor\",instance=\"#{instance}\""
3027
super(options)
3128
end
3229

@@ -43,14 +40,11 @@ def query_range(options)
4340

4441
# A client with special labels for pod cadvisor metrics
4542
class Pod < Client
46-
def initialize(**options)
43+
def initialize(options = {})
4744
pod_name = options[:pod_name]
4845
namespace = options[:namespace] || 'default'
49-
region = options[:region] || 'infra'
50-
zone = options[:zone] || 'default'
5146

52-
@labels = "job=\"kubernetes-cadvisor\",region=\"#{region}\"," \
53-
"zone=\"#{zone}\",namespace=\"#{namespace}\"," \
47+
@labels = "job=\"kubernetes-cadvisor\",namespace=\"#{namespace}\"," \
5448
"pod_name=\"#{pod_name}\",container_name=\"POD\""
5549
super(options)
5650
end
@@ -68,15 +62,12 @@ def query_range(options)
6862

6963
# A client with special labels for container cadvisor metrics
7064
class Container < Client
71-
def initialize(**options)
65+
def initialize(options = {})
7266
container_name = args[:container_name]
7367
pod_name = args[:pod_name]
7468
namespace = args[:namespace] || 'default'
75-
region = options[:region] || 'infra'
76-
zone = options[:zone] || 'default'
7769

78-
@labels = "job=\"kubernetes-cadvisor\",region=\"#{region}\"," \
79-
"zone=\"#{zone}\",namespace=\"#{namespace}\"," \
70+
@labels = "job=\"kubernetes-cadvisor\",namespace=\"#{namespace}\"," \
8071
"pod_name=\"#{pod_name}\",container_name=\"#{container_name}\""
8172
super(options)
8273
end

0 commit comments

Comments
 (0)