prometheus-client 0.4.1 → 0.4.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 +8 -8
- data/README.md +4 -2
- data/lib/prometheus/client/formats/json.rb +1 -2
- data/lib/prometheus/client/formats/text.rb +2 -2
- data/lib/prometheus/client/label_set_validator.rb +3 -3
- data/lib/prometheus/client/metric.rb +2 -1
- data/lib/prometheus/client/push.rb +4 -3
- data/lib/prometheus/client/rack/collector.rb +3 -2
- data/lib/prometheus/client/rack/exporter.rb +1 -2
- data/lib/prometheus/client/summary.rb +2 -1
- 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
|
+
NjQwNjBmMGRjMjYwMzJmOWVlMDRkNDJiNWM0MTQzYTkwNGE5MWVlZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzEyNGViYThkNTViN2RlZTllYTE4MDE1OTQwNDBiMjdhZDQ4MmViNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTBlMDI5NWY3M2UxODgxOTM2MTdiMWM1ODJhZDQxYzRmMGE4NTY2NTBmNWM1
|
10
|
+
ZjczYTQxZTk0ODNlYjk5YmQ3MDJjMzE0MDU1NTljOGU1ODBlYmY5YjRjOTYy
|
11
|
+
MmJlZTY4YWEyMjczMzQwNjVlMWEzZDNlM2VhZTIwZWYyYjY4MGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWY2ZWRmOTcwZDE0YTdiOTI3MTRlMzE0MDVmNzU3M2RkMjlmYWMyN2E1OGQx
|
14
|
+
MjJlMTk4ZTg3OTQ3YzQyZTE0Nzg4NTEzYjk0ZDI3MDc5OTU5NWQyMjcyOTNk
|
15
|
+
MDg1MjcyNTllNmZjMzM5N2MxMGI5OWFiODUyNjA4MGYzMGNiMDA=
|
data/README.md
CHANGED
@@ -35,8 +35,8 @@ http_requests.increment
|
|
35
35
|
### Rack middleware
|
36
36
|
|
37
37
|
There are two [Rack][2] middlewares available, one to expose a metrics HTTP
|
38
|
-
endpoint to be scraped by a prometheus server and one to trace all HTTP
|
39
|
-
requests.
|
38
|
+
endpoint to be scraped by a prometheus server ([Exporter][9]) and one to trace all HTTP
|
39
|
+
requests ([Collector][10]).
|
40
40
|
|
41
41
|
```ruby
|
42
42
|
# config.ru
|
@@ -160,3 +160,5 @@ rake
|
|
160
160
|
[6]: https://codeclimate.com/github/prometheus/client_ruby.png
|
161
161
|
[7]: https://coveralls.io/repos/prometheus/client_ruby/badge.png?branch=master
|
162
162
|
[8]: https://github.com/prometheus/pushgateway
|
163
|
+
[9]: lib/prometheus/client/rack/exporter.rb
|
164
|
+
[10]: lib/prometheus/client/rack/collector.rb
|
@@ -11,8 +11,7 @@ module Prometheus
|
|
11
11
|
MEDIA_TYPE = 'application/json'
|
12
12
|
SCHEMA = 'prometheus/telemetry'
|
13
13
|
VERSION = '0.0.2'
|
14
|
-
CONTENT_TYPE =
|
15
|
-
%Q(#{MEDIA_TYPE}; schema="#{SCHEMA}"; version=#{VERSION})
|
14
|
+
CONTENT_TYPE = %(#{MEDIA_TYPE}; schema="#{SCHEMA}"; version=#{VERSION})
|
16
15
|
|
17
16
|
MAPPING = { summary: :histogram }
|
18
17
|
|
@@ -7,7 +7,7 @@ module Prometheus
|
|
7
7
|
module Text
|
8
8
|
MEDIA_TYPE = 'text/plain'
|
9
9
|
VERSION = '0.0.4'
|
10
|
-
CONTENT_TYPE =
|
10
|
+
CONTENT_TYPE = "#{MEDIA_TYPE}; version=#{VERSION}"
|
11
11
|
|
12
12
|
METRIC_LINE = '%s%s %s'
|
13
13
|
TYPE_LINE = '# TYPE %s %s'
|
@@ -55,7 +55,7 @@ module Prometheus
|
|
55
55
|
|
56
56
|
l = labels(set)
|
57
57
|
yield metric("#{name}_sum", l, value.sum)
|
58
|
-
yield metric("#{name}
|
58
|
+
yield metric("#{name}_count", l, value.total)
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.metric(name, labels, value)
|
@@ -8,10 +8,10 @@ module Prometheus
|
|
8
8
|
# TODO: we might allow setting :instance in the future
|
9
9
|
RESERVED_LABELS = [:job, :instance]
|
10
10
|
|
11
|
-
class LabelSetError
|
11
|
+
class LabelSetError < StandardError; end
|
12
12
|
class InvalidLabelSetError < LabelSetError; end
|
13
|
-
class InvalidLabelError
|
14
|
-
class ReservedLabelError
|
13
|
+
class InvalidLabelError < LabelSetError; end
|
14
|
+
class ReservedLabelError < LabelSetError; end
|
15
15
|
|
16
16
|
def initialize
|
17
17
|
@validated = {}
|
@@ -20,9 +20,10 @@ module Prometheus
|
|
20
20
|
attr_reader :job, :instance, :gateway, :path
|
21
21
|
|
22
22
|
def initialize(job, instance = nil, gateway = nil)
|
23
|
-
@job
|
24
|
-
|
25
|
-
@
|
23
|
+
@job = job
|
24
|
+
@instance = instance
|
25
|
+
@gateway = gateway || DEFAULT_GATEWAY
|
26
|
+
@uri = parse(@gateway)
|
26
27
|
@path = build_path(job, instance)
|
27
28
|
@http = Net::HTTP.new(@uri.host, @uri.port)
|
28
29
|
end
|
@@ -6,7 +6,8 @@ module Prometheus
|
|
6
6
|
module Client
|
7
7
|
module Rack
|
8
8
|
# Collector is a Rack middleware that provides a sample implementation of
|
9
|
-
# a
|
9
|
+
# a HTTP tracer. The default label builder can be modified to export a
|
10
|
+
# different set of labels per recorded metric.
|
10
11
|
class Collector
|
11
12
|
attr_reader :app, :registry
|
12
13
|
|
@@ -37,7 +38,7 @@ module Prometheus
|
|
37
38
|
@requests_duration = @registry.counter(
|
38
39
|
:http_request_durations_total_microseconds,
|
39
40
|
'The total amount of time spent answering HTTP requests ' \
|
40
|
-
'(microseconds).'
|
41
|
+
'(microseconds).')
|
41
42
|
@durations = @registry.summary(
|
42
43
|
:http_request_durations_microseconds,
|
43
44
|
'A histogram of the response latency (microseconds).')
|
@@ -8,8 +8,7 @@ module Prometheus
|
|
8
8
|
module Client
|
9
9
|
module Rack
|
10
10
|
# Exporter is a Rack middleware that provides a sample implementation of
|
11
|
-
# a HTTP
|
12
|
-
# differet set of labels per recorded metric.
|
11
|
+
# a Prometheus HTTP client API.
|
13
12
|
class Exporter
|
14
13
|
attr_reader :app, :registry, :path
|
15
14
|
|
@@ -13,7 +13,8 @@ module Prometheus
|
|
13
13
|
attr_accessor :sum, :total
|
14
14
|
|
15
15
|
def initialize(estimator)
|
16
|
-
@sum
|
16
|
+
@sum = estimator.sum
|
17
|
+
@total = estimator.observations
|
17
18
|
|
18
19
|
estimator.invariants.each do |invariant|
|
19
20
|
self[invariant.quantile] = estimator.query(invariant.quantile)
|
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.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schmidt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: quantile
|