prometheus-client 0.3.1 → 0.4.0
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 +8 -8
- data/README.md +6 -2
- data/lib/prometheus/client/push.rb +9 -3
- data/lib/prometheus/client/rack/collector.rb +3 -3
- data/lib/prometheus/client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWQ3NGY0YTg3OGJjMzdlNGQ2YjczNDcxNjdiZTQ1MDMxYzg2YzE5Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzNiODVjNWMwMzRhOTJhYzljNmFiMGI2YzQ5ZWZmODI0MWUxZWYyYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWE1YTIxZjliZTZmZTI5ZmJmM2QyNDQyYmE0OWIyNzg3MTZhNGE3YzI4ZTA4
|
10
|
+
M2IyOTAxNDUwZDU5NWI0MjczYzUyNTI2YjQzZWExNThjNTU5MzM4ZDQ2MjBj
|
11
|
+
NWM2OGY5YjNhZDZhMjgzYTZlYzVmYTAyNWU5ODdmZmRiZTQwZjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTYxMGE5ZGNkYWNlYWNhNDU4YmY4ODIxYzVjZGM1NmVkMTUxZDBjZGYzOTA1
|
14
|
+
YzNmMzkxMTM2Zjc1ZTgzYTIzNjY1N2NkZDgxNzhjZjljMzQwZWJmZTM4ODAw
|
15
|
+
Njc1M2M0NWZiMGMwYTkyZmYzOGNmZjY0YWYyMGMwOGZmNGY1Yzk=
|
data/README.md
CHANGED
@@ -71,11 +71,15 @@ prometheus = Prometheus::Client.registry
|
|
71
71
|
# ... register some metrics, set/add/increment/etc. their values
|
72
72
|
|
73
73
|
# push the registry state to the default gateway
|
74
|
-
Prometheus::Client::Push.new('my-batch-job').
|
74
|
+
Prometheus::Client::Push.new('my-batch-job').add(prometheus)
|
75
75
|
|
76
76
|
# optional: specify the instance name (instead of IP) and gateway
|
77
77
|
Prometheus::Client::Push.new(
|
78
|
-
'my-job', 'instance-name', 'http://example.domain:1234').
|
78
|
+
'my-job', 'instance-name', 'http://example.domain:1234').add(prometheus)
|
79
|
+
|
80
|
+
# If you want to replace any previously pushed metrics for a given instance,
|
81
|
+
# use the #replace method.
|
82
|
+
Prometheus::Client::Push.new('my-batch-job', 'instance').replace(prometheus)
|
79
83
|
```
|
80
84
|
|
81
85
|
## Metrics
|
@@ -24,13 +24,19 @@ module Prometheus
|
|
24
24
|
|
25
25
|
@uri = parse(@gateway)
|
26
26
|
@path = build_path(job, instance)
|
27
|
+
@http = Net::HTTP.new(@uri.host, @uri.port)
|
27
28
|
end
|
28
29
|
|
29
|
-
def
|
30
|
+
def add(registry)
|
30
31
|
data = Formats::Text.marshal(registry)
|
31
|
-
http = Net::HTTP.new(@uri.host, @uri.port)
|
32
32
|
|
33
|
-
http.send_request('PUT', path, data, HEADER)
|
33
|
+
@http.send_request('PUT', path, data, HEADER)
|
34
|
+
end
|
35
|
+
|
36
|
+
def replace(registry)
|
37
|
+
@http.send_request('DELETE', path)
|
38
|
+
|
39
|
+
add(registry)
|
34
40
|
end
|
35
41
|
|
36
42
|
private
|
@@ -33,20 +33,20 @@ module Prometheus
|
|
33
33
|
def init_request_metrics
|
34
34
|
@requests = @registry.counter(
|
35
35
|
:http_requests_total,
|
36
|
-
'A counter of the total number of HTTP requests made.'
|
36
|
+
'A counter of the total number of HTTP requests made.')
|
37
37
|
@requests_duration = @registry.counter(
|
38
38
|
:http_request_durations_total_microseconds,
|
39
39
|
'The total amount of time spent answering HTTP requests ' \
|
40
40
|
'(microseconds).',)
|
41
41
|
@durations = @registry.summary(
|
42
42
|
:http_request_durations_microseconds,
|
43
|
-
'A histogram of the response latency (microseconds).'
|
43
|
+
'A histogram of the response latency (microseconds).')
|
44
44
|
end
|
45
45
|
|
46
46
|
def init_exception_metrics
|
47
47
|
@exceptions = @registry.counter(
|
48
48
|
:http_exceptions_total,
|
49
|
-
'A counter of the total number of exceptions raised.'
|
49
|
+
'A counter of the total number of exceptions raised.')
|
50
50
|
end
|
51
51
|
|
52
52
|
def trace(env)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schmidt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: quantile
|