prometheus_exporter 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis +1 -1
- data/CHANGELOG +6 -1
- data/lib/prometheus_exporter/metric/base.rb +26 -0
- data/lib/prometheus_exporter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88f0f450fbf76e51d739c1f9abc7cea62e2651dd366c5e9bd38df9464ebf797e
|
4
|
+
data.tar.gz: a89f2e00749002ba9323a6741cc682fb9bd2df051dd96cd68c9c9fd6e51d73d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32922666245bacfd8d608a4a08c255ef8103f70c7ba31974ed3c2685cc261b05df25d17e2c0bc38c50d67a576388d98ae9150b204a0385d3d516f298b77aa6e4
|
7
|
+
data.tar.gz: 360d70c6f3c03e31158a43f26fccee61ec25717a2b4f021ff46902b447f864533e543083d5dc675bdab0f47df93288f3f7f60157145fbea5a1e1062d6981e4fa
|
data/.travis
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
0.4.7 - 08-04-2019
|
2
|
+
|
3
|
+
- Fix: collector was not escaping " \ and \n correctly. This could lead
|
4
|
+
to a corrupt payload in some cases.
|
5
|
+
|
1
6
|
0.4.6 - 02-04-2019
|
2
7
|
|
3
8
|
- Feature: Allow resetting a counter
|
@@ -11,7 +16,7 @@
|
|
11
16
|
|
12
17
|
0.4.4 - 13-02-2019
|
13
18
|
|
14
|
-
- Feature: add support for local metric collection without using HTTP
|
19
|
+
- Feature: add support for local metric collection without using HTTP
|
15
20
|
|
16
21
|
0.4.3 - 11-02-2019
|
17
22
|
|
@@ -57,6 +57,8 @@ module PrometheusExporter::Metric
|
|
57
57
|
labels = (labels || {}).merge(Base.default_labels)
|
58
58
|
if labels && labels.length > 0
|
59
59
|
s = labels.map do |key, value|
|
60
|
+
value = value.to_s
|
61
|
+
value = escape_value(value) if needs_escape?(value)
|
60
62
|
"#{key}=\"#{value}\""
|
61
63
|
end.join(",")
|
62
64
|
"{#{s}}"
|
@@ -70,5 +72,29 @@ module PrometheusExporter::Metric
|
|
70
72
|
#{metric_text}
|
71
73
|
TEXT
|
72
74
|
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def escape_value(str)
|
79
|
+
str.gsub(/[\n"\\]/m) do |m|
|
80
|
+
if m == "\n"
|
81
|
+
"\\n"
|
82
|
+
else
|
83
|
+
"\\#{m}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# when we drop Ruby 2.3 we can drop this
|
89
|
+
if "".respond_to? :match?
|
90
|
+
def needs_escape?(str)
|
91
|
+
str.match?(/[\n"\\]/m)
|
92
|
+
end
|
93
|
+
else
|
94
|
+
def needs_escape?(str)
|
95
|
+
!!str.match(/[\n"\\]/m)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
73
99
|
end
|
74
100
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus_exporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|