@@ -36,18 +36,40 @@ prometheus.get(
3636
3737``` ruby
3838# return a client for host http://example.com:9090/api/v1/
39- prometheus = Prometheus ::ApiClient .client(' example.com' )
39+ prometheus = Prometheus ::ApiClient .client(' http:// example.com:9090 ' )
4040```
4141
4242#### Authentication proxy
4343
4444If an authentication proxy ( e.g. oauth2 ) is used in a layer above the prometheus REST server, this client can use ssl and authentication headears.
4545
4646``` ruby
47- # return a client for host https://example.com/api/v1/
48- prometheus = Prometheus ::ApiClient .client(' example.com' , scheme: ' https ' , port: 443 )
47+ # return a client for host https://example.com/api/v1/ using a Bearer token "TopSecret"
48+ prometheus = Prometheus ::ApiClient .client(' https:// example.com:443 ' , credentials: { token: ' TopSecret ' } )
4949```
5050
51+ #### High level calls
52+
53+ ``` ruby
54+
55+ # send a query request to server
56+ prometheus.query(
57+ :query => " sum(container_cpu_usage_seconds_total{container_name=\" prometheus-hgv4s\" ,job=\" kubernetes-nodes\" })" ,
58+ :start => " 2015-07-01T20:10:30.781Z" ,
59+ :end => " 2015-07-02T20:10:30.781Z"
60+ )
61+
62+ # send a query_range request to server
63+ prometheus.query_range(
64+ :query => " sum(container_cpu_usage_seconds_total{container_name=\" prometheus-hgv4s\" ,job=\" kubernetes-nodes\" })" ,
65+ :start => " 2015-07-01T20:10:30.781Z" ,
66+ :end => " 2015-07-02T20:10:30.781Z" ,
67+ :step => " 120s"
68+ )
69+
70+ # send a label request to server
71+ prometheus.label(' __name__' )
72+ ```
5173## Tests
5274
5375Install necessary development gems with ` bundle install ` and run tests with
0 commit comments