prometheus-api-client 0.3.1 → 0.3.2
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 +49 -1
- data/lib/prometheus/api_client/cadvisor.rb +2 -1
- 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: 905999226f7bda4a27b8a4919b4483e297c363eb
|
4
|
+
data.tar.gz: d4765428ac8620f0b9629d47359bb702a25abdcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08df780379f2a4e2d7b099931f936fc02d36351dd8452f4b5627fee2f8f68df83bfc4c474e6ea634cd6ca7b40e5c36fb3d15fb43bd744cbd04cd333e577bd0dd'
|
7
|
+
data.tar.gz: 8ebe88a2fce0fe01fe4428972ea881aae45538f508fdba7caabe98b27521d42def3dc4201dcb43ea292079bfa258726a0c3b9df4f15ed557b3e95195a793010b
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
[![Build Status][3]](https://codeclimate.com/github/yaacov/prometheus_api_client_ruby)
|
6
6
|
[![Coverage Status][4]](https://coveralls.io/github/yaacov/prometheus_api_client_ruby?branch=master)
|
7
7
|
|
8
|
-
A Ruby library for reading Prometheus
|
8
|
+
A Ruby library for reading metrics stored on a Prometheus server.
|
9
9
|
|
10
10
|
## Install
|
11
11
|
|
@@ -61,7 +61,9 @@ prometheus.query(
|
|
61
61
|
"{container_name=\"prometheus-hgv4s\",job=\"kubernetes-nodes\"})",
|
62
62
|
:time => "2015-07-01T20:10:30.781Z",
|
63
63
|
)
|
64
|
+
```
|
64
65
|
|
66
|
+
```ruby
|
65
67
|
# send a query_range request to server
|
66
68
|
prometheus.query_range(
|
67
69
|
:query => "sum(container_cpu_usage_seconds_total" \
|
@@ -70,16 +72,62 @@ prometheus.query_range(
|
|
70
72
|
:end => "2015-07-02T20:10:30.781Z",
|
71
73
|
:step => "120s"
|
72
74
|
)
|
75
|
+
```
|
73
76
|
|
77
|
+
Example of response to metrics request:
|
78
|
+
```
|
79
|
+
{"resultType"=>"matrix",
|
80
|
+
"result"=>
|
81
|
+
[{"metric"=>
|
82
|
+
{"__name__"=>"container_cpu_usage_seconds_total",
|
83
|
+
"beta_kubernetes_io_arch"=>"amd64",
|
84
|
+
"beta_kubernetes_io_os"=>"linux",
|
85
|
+
"cpu"=>"cpu00",
|
86
|
+
"id"=>"/",
|
87
|
+
"instance"=>"example.com",
|
88
|
+
"job"=>"kubernetes-cadvisor",
|
89
|
+
"kubernetes_io_hostname"=>"example.com",
|
90
|
+
"region"=>"infra",
|
91
|
+
"zone"=>"default"},
|
92
|
+
"values"=>[[1502086230.781, "51264.830099022"],
|
93
|
+
[1502086470.781, "51277.367732154"]]},
|
94
|
+
{"metric"=>
|
95
|
+
{"__name__"=>"container_cpu_usage_seconds_total",
|
96
|
+
"beta_kubernetes_io_arch"=>"amd64",
|
97
|
+
"beta_kubernetes_io_os"=>"linux",
|
98
|
+
"cpu"=>"cpu01",
|
99
|
+
"id"=>"/",
|
100
|
+
"instance"=>"example.com",
|
101
|
+
"job"=>"kubernetes-cadvisor",
|
102
|
+
"kubernetes_io_hostname"=>"example.com",
|
103
|
+
"region"=>"infra",
|
104
|
+
"zone"=>"default"},
|
105
|
+
"values"=>[[1502086230.781, "53879.644934689"],
|
106
|
+
[1502086470.781, "53892.665282065"]]}]}
|
107
|
+
```
|
108
|
+
|
109
|
+
```ruby
|
74
110
|
# send a label request to server
|
75
111
|
prometheus.label('__name__')
|
76
112
|
```
|
77
113
|
|
114
|
+
Example of response to a label request:
|
115
|
+
```
|
116
|
+
["kubernetes-apiservers", "kubernetes-cadvisor", "kubernetes-nodes",
|
117
|
+
"kubernetes-service-endpoints"]
|
118
|
+
```
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
# send a targets request to server
|
122
|
+
prometheus.targets()
|
123
|
+
```
|
124
|
+
|
78
125
|
#### cAdvisor specialize client
|
79
126
|
|
80
127
|
```ruby
|
81
128
|
|
82
129
|
# create a client for cAdvisor metrics of a Node instance 'example.com'
|
130
|
+
# connected to a Prometheus server listening on http://example.com:8080
|
83
131
|
prometheus = Prometheus::ApiClient::Cadvisor::Node.new(
|
84
132
|
instance: 'example.com',
|
85
133
|
url: 'http://example.com:8080',
|
@@ -23,7 +23,8 @@ module Prometheus
|
|
23
23
|
def initialize(options = {})
|
24
24
|
instance = options[:instance]
|
25
25
|
|
26
|
-
@labels = "job=\"kubernetes-cadvisor\",instance=\"#{instance}\""
|
26
|
+
@labels = "job=\"kubernetes-cadvisor\",instance=\"#{instance}\"," \
|
27
|
+
'id="/"'
|
27
28
|
super(options)
|
28
29
|
end
|
29
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaacov Zamir
|
@@ -74,5 +74,5 @@ rubyforge_project:
|
|
74
74
|
rubygems_version: 2.6.11
|
75
75
|
signing_key:
|
76
76
|
specification_version: 4
|
77
|
-
summary: A suite of reading
|
77
|
+
summary: A suite of reading metrics stored on a Prometheus server.
|
78
78
|
test_files: []
|