prometheus-api-client 0.4.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/prometheus/api_client/cadvisor.rb +25 -6
- data/lib/prometheus/api_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05ac806cc363c0bd274032ab1a07877f09e774f4
|
4
|
+
data.tar.gz: b1612a15ccf17eb234b3abff6e34c7e71217a9ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b83bcd065a1b5d20a06893192ad165443d114bdc1ce373633f0484a7e688c5a7f9073cc65d800318f47d5d96aeb37a4575acc692d70d19c049c8e1200f22abc8
|
7
|
+
data.tar.gz: 16ac21572fb55cdf744eb3a7d7c83d90e756eae83bb7c0c5b6677fecc74e5301edc8abac774ce57dafcef7c134fb431b1f5c2a93ee922bd4851c6d3b95186cf6
|
data/README.md
CHANGED
@@ -47,8 +47,8 @@ prometheus = Prometheus::ApiClient.client(url: 'https://example.com:443'
|
|
47
47
|
###### query
|
48
48
|
|
49
49
|
```ruby
|
50
|
-
require 'prometheus/api_client'
|
51
50
|
|
51
|
+
# send a low level get request to server
|
52
52
|
prometheus.get(
|
53
53
|
'query_range',
|
54
54
|
query: 'sum(container_cpu_usage_seconds_total' \
|
@@ -36,8 +36,14 @@ module Prometheus
|
|
36
36
|
def initialize(options = {})
|
37
37
|
instance = options[:instance]
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
# if no instance is given, assume we want data on all nodes
|
40
|
+
@labels = if instance
|
41
|
+
'job="kubernetes-cadvisor",id="/",' \
|
42
|
+
"instance=\"#{instance}\""
|
43
|
+
else
|
44
|
+
'job="kubernetes-cadvisor",id="/"'
|
45
|
+
end
|
46
|
+
|
41
47
|
super(options)
|
42
48
|
end
|
43
49
|
end
|
@@ -48,8 +54,14 @@ module Prometheus
|
|
48
54
|
pod_name = options[:pod_name]
|
49
55
|
namespace = options[:namespace] || 'default'
|
50
56
|
|
51
|
-
|
52
|
-
|
57
|
+
# if no pod_name is given, assume we want data on all pods
|
58
|
+
@labels = if pod_name
|
59
|
+
'job="kubernetes-cadvisor",container_name="POD",' \
|
60
|
+
"pod_name=\"#{pod_name}\",namespace=\"#{namespace}\""
|
61
|
+
else
|
62
|
+
'job="kubernetes-cadvisor",container_name="POD"'
|
63
|
+
end
|
64
|
+
|
53
65
|
super(options)
|
54
66
|
end
|
55
67
|
end
|
@@ -61,8 +73,15 @@ module Prometheus
|
|
61
73
|
pod_name = options[:pod_name]
|
62
74
|
namespace = options[:namespace] || 'default'
|
63
75
|
|
64
|
-
|
65
|
-
|
76
|
+
# if no container_name is given, assume we want data on all containers
|
77
|
+
@labels = if container_name
|
78
|
+
'job="kubernetes-cadvisor",' \
|
79
|
+
"namespace=\"#{namespace}\",pod_name=\"#{pod_name}\"," \
|
80
|
+
"container_name=\"#{container_name}\""
|
81
|
+
else
|
82
|
+
'job="kubernetes-cadvisor",container_name!="POD"'
|
83
|
+
end
|
84
|
+
|
66
85
|
super(options)
|
67
86
|
end
|
68
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaacov Zamir
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|