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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f98a4aea6667c830dfe09fb682ab1c02e06930a4
4
- data.tar.gz: 2d36c78279cf1e3db674d9dc3db3a179b0525e39
3
+ metadata.gz: 905999226f7bda4a27b8a4919b4483e297c363eb
4
+ data.tar.gz: d4765428ac8620f0b9629d47359bb702a25abdcd
5
5
  SHA512:
6
- metadata.gz: 662fde2340f4e588c5e874d3507958ac51db2975edd97bac9d60243d4fa83d3e82b64c8b3df57eaa72e449404cc525725e58939ac7bf8e406a67faca66004fde
7
- data.tar.gz: 718bd0e4be1aaa2fc47f285f51f33d3f75b1b76254800438190cfbeaa5ee29a6fa8f54e4a212efa18758ca78997339e065646ebb417217df18af3fb6bdbffdc4
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 metrics API.
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Prometheus
4
4
  module ApiClient
5
- VERSION = '0.3.1'
5
+ VERSION = '0.3.2'
6
6
  end
7
7
  end
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.1
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 metric values that are exposed through an API interface.
77
+ summary: A suite of reading metrics stored on a Prometheus server.
78
78
  test_files: []