Skip to content

Commit c30138e

Browse files
committed
bump version
1 parent fa8f294 commit c30138e

3 files changed

Lines changed: 27 additions & 5 deletions

File tree

README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4444
If 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

5375
Install necessary development gems with `bundle install` and run tests with

lib/prometheus/api_client/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def query_range(options)
2222
run_command('query_range', options)
2323
end
2424

25-
def label(tag, options)
25+
def label(tag, options={})
2626
run_command("label/#{tag}/values", options)
2727
end
2828

lib/prometheus/api_client/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module Prometheus
44
module ApiClient
5-
VERSION = '0.1.0'
5+
VERSION = '0.1.1'
66
end
77
end

0 commit comments

Comments
 (0)