@@ -24,12 +24,12 @@ require 'prometheus/api_client'
2424prometheus = Prometheus ::ApiClient .client
2525
2626prometheus.get(
27- " query_range" ,
28- query: " sum(container_cpu_usage_seconds_total" \
29- " {container_name=\ " prometheus-hgv4s\ " ,job=\ " kubernetes-nodes\ " })" ,
30- start: " 2015-07-01T20:10:30.781Z" ,
31- end: " 2015-07-02T20:10:30.781Z" ,
32- step: " 120s"
27+ ' query_range' ,
28+ query: ' sum(container_cpu_usage_seconds_total' \
29+ ' {container_name="prometheus-hgv4s",job="kubernetes-nodes"})' ,
30+ start: ' 2015-07-01T20:10:30.781Z' ,
31+ end: ' 2015-07-02T20:10:30.781Z' ,
32+ step: ' 120s' ,
3333)
3434```
3535
@@ -48,7 +48,7 @@ prometheus REST server, this client can use ssl and authentication headears.
4848``` ruby
4949# return a client for host https://example.com/api/v1/ using a Bearer token "TopSecret"
5050prometheus = Prometheus ::ApiClient .client(url: ' https://example.com:443' ,
51- credentials: {token: ' TopSecret' })
51+ credentials: { token: ' TopSecret' })
5252```
5353
5454#### High level calls
@@ -57,20 +57,20 @@ prometheus = Prometheus::ApiClient.client(url: 'https://example.com:443'
5757
5858# send a query request to server
5959prometheus.query(
60- query: " sum(container_cpu_usage_seconds_total" \
61- " {container_name=\ " prometheus-hgv4s\ " ,job=\ " kubernetes-nodes\ " })" ,
62- time: " 2015-07-01T20:10:30.781Z" ,
60+ query: ' sum(container_cpu_usage_seconds_total' \
61+ ' {container_name="prometheus-hgv4s",job="kubernetes-nodes"})' ,
62+ time: ' 2015-07-01T20:10:30.781Z' ,
6363)
6464```
6565
6666``` ruby
6767# send a query_range request to server
6868prometheus.query_range(
69- query: " sum(container_cpu_usage_seconds_total" \
70- " {container_name=\ " prometheus-hgv4s\ " ,job=\ " kubernetes-nodes\ " })" ,
71- start: " 2015-07-01T20:10:30.781Z" ,
72- end: " 2015-07-02T20:10:30.781Z" ,
73- step: " 120s"
69+ query: ' sum(container_cpu_usage_seconds_total' \
70+ ' {container_name="prometheus-hgv4s",job="kubernetes-nodes"})' ,
71+ start: ' 2015-07-01T20:10:30.781Z' ,
72+ end: ' 2015-07-02T20:10:30.781Z' ,
73+ step: ' 120s' ,
7474)
7575
7676# response from server:
@@ -126,13 +126,13 @@ prometheus.targets()
126126# connected to a Prometheus server listening on http://example.com:8080
127127prometheus = Prometheus ::ApiClient ::Cadvisor ::Node .new (
128128 instance: ' example.com' ,
129- url: ' http://example.com:8080' ,
129+ url: ' http://example.com:8080' ,
130130)
131131
132132# send a query request to server
133133prometheus.query(
134- query: " sum(container_cpu_usage_seconds_total)" ,
135- time: " 2015-07-01T20:10:30.781Z" ,
134+ query: ' sum(container_cpu_usage_seconds_total)' ,
135+ time: ' 2015-07-01T20:10:30.781Z' ,
136136)
137137```
138138
0 commit comments