55[ ![ Build Status] [ 3 ]] ( https://codeclimate.com/github/yaacov/prometheus_api_client_ruby )
66[ ![ Coverage Status] [ 4 ]] ( https://coveralls.io/github/yaacov/prometheus_api_client_ruby?branch=master )
77
8- A Ruby library for reading Prometheus metrics API .
8+ A Ruby library for reading metrics stored on a Prometheus server .
99
1010## Install
1111
@@ -61,7 +61,9 @@ prometheus.query(
6161 " {container_name=\" prometheus-hgv4s\" ,job=\" kubernetes-nodes\" })" ,
6262 :time => " 2015-07-01T20:10:30.781Z" ,
6363)
64+ ```
6465
66+ ``` ruby
6567# send a query_range request to server
6668prometheus.query_range(
6769 :query => " sum(container_cpu_usage_seconds_total" \
@@ -70,11 +72,56 @@ prometheus.query_range(
7072 :end => " 2015-07-02T20:10:30.781Z" ,
7173 :step => " 120s"
7274)
75+ ```
7376
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
74110# send a label request to server
75111prometheus.label(' __name__' )
76112```
77113
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+
78125#### cAdvisor specialize client
79126
80127``` ruby
0 commit comments