prometheus-client 0.3.0.pre.rc.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/prometheus/client/formats/text.rb +15 -10
- data/lib/prometheus/client/rack/exporter.rb +12 -4
- data/lib/prometheus/client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTg5OWIzZmEwM2Y5ZTJlYTZhYmZiYmJjNWQ2YzllZDY3ODE0NzZlMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGViMTA5YzQ5ODNiMGMwOTg0OGRkMGYwYjQ4Mjg5ZDMxZjYxYjkxMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjdhODgyNjgyYzQyMmRmNzQyM2FjMzg2MDQ5NDIwNjM3MzBlNmQwMGVhNTlk
|
10
|
+
NWFhNzE0NjU0Mjg2OGE2ZWQzNTNlNmVjODU3MDlmMzZjNmExMmY5ZjkxYzlh
|
11
|
+
NmQ3ZDVkOTUzZTk0Yzk3ODAyZTk4ZmZiNGU2M2M1NmU1YzFmMjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODMzOGU1MzVjN2M2NzFmZDQyZjc4MjgwMzRmYjViZDY4MTliNzM2ZDYwNDlm
|
14
|
+
MjE0YWQ5ZWI1MDA5MjZlY2U0NGExNzA2MWJlYjk2YWU1NjkwNjdkOWJjZWJj
|
15
|
+
ZGMzNmJhZDZiZTgyMTkzYmY1YmFmMmZmNDUzYmQ1ZjE3MDU5NWI=
|
@@ -28,8 +28,7 @@ module Prometheus
|
|
28
28
|
lines << format(HELP_LINE, metric.name, escape(metric.docstring))
|
29
29
|
|
30
30
|
metric.values.each do |label_set, value|
|
31
|
-
|
32
|
-
representation(metric, set, value) { |l| lines << l }
|
31
|
+
representation(metric, label_set, value) { |l| lines << l }
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
@@ -39,20 +38,26 @@ module Prometheus
|
|
39
38
|
|
40
39
|
private
|
41
40
|
|
42
|
-
def self.representation(metric,
|
43
|
-
|
44
|
-
value.each do |q, v|
|
45
|
-
yield metric(metric.name, labels(set.merge(quantile: q)), v)
|
46
|
-
end
|
41
|
+
def self.representation(metric, label_set, value, &block)
|
42
|
+
set = metric.base_labels.merge(label_set)
|
47
43
|
|
48
|
-
|
49
|
-
|
50
|
-
yield metric("#{metric.name}_total", l, value.total)
|
44
|
+
if metric.type == :summary
|
45
|
+
summary(metric.name, set, value, &block)
|
51
46
|
else
|
52
47
|
yield metric(metric.name, labels(set), value)
|
53
48
|
end
|
54
49
|
end
|
55
50
|
|
51
|
+
def self.summary(name, set, value)
|
52
|
+
value.each do |q, v|
|
53
|
+
yield metric(name, labels(set.merge(quantile: q)), v)
|
54
|
+
end
|
55
|
+
|
56
|
+
l = labels(set)
|
57
|
+
yield metric("#{name}_sum", l, value.sum)
|
58
|
+
yield metric("#{name}_total", l, value.total)
|
59
|
+
end
|
60
|
+
|
56
61
|
def self.metric(name, labels, value)
|
57
62
|
format(METRIC_LINE, name, labels, value)
|
58
63
|
end
|
@@ -47,14 +47,22 @@ module Prometheus
|
|
47
47
|
def parse(header)
|
48
48
|
header.to_s.split(/\s*,\s*/).map do |type|
|
49
49
|
attributes = type.split(/\s*;\s*/)
|
50
|
-
quality =
|
51
|
-
|
52
|
-
quality = attr.split('q=').last.to_f if attr.start_with?('q=')
|
53
|
-
end
|
50
|
+
quality = extract_quality(attributes)
|
51
|
+
|
54
52
|
[attributes.join('; '), quality]
|
55
53
|
end.sort_by(&:last).reverse
|
56
54
|
end
|
57
55
|
|
56
|
+
def extract_quality(attributes, default = 1.0)
|
57
|
+
quality = default
|
58
|
+
|
59
|
+
attributes.delete_if do |attr|
|
60
|
+
quality = attr.split('q=').last.to_f if attr.start_with?('q=')
|
61
|
+
end
|
62
|
+
|
63
|
+
quality
|
64
|
+
end
|
65
|
+
|
58
66
|
def respond_with(format)
|
59
67
|
[
|
60
68
|
200,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schmidt
|
@@ -61,9 +61,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
61
|
version: '0'
|
62
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - ! '
|
64
|
+
- - ! '>='
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
66
|
+
version: '0'
|
67
67
|
requirements: []
|
68
68
|
rubyforge_project:
|
69
69
|
rubygems_version: 2.1.11
|