prometheus_parser 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prometheus_parser.rb +6 -1
- data/prometheus_parser.gemspec +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: 799d68fa0a008c6d396dac454eef330d53d2f5c4fbb058199b4134409a8e1361
|
4
|
+
data.tar.gz: 8c6e4e60fdb3cc3201eef732a05971bff03094132ee192fd96d3040405828462
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ce464bfb19e3e7d5e83c5d08587f3084efbe4bc1ddae2b54153fa11e046dd71ebfffb652ed8c5438ac23da7fc10114e95d4b4b2adabb80c8703b819adc61e66
|
7
|
+
data.tar.gz: d533222e3940029e74816d96f4a6392efc305c07a78b6961ef52b97956cbb63d6c2e25e9c547832beac119f682a8efb017890edfd836ff5a6ef044bce273c956
|
data/lib/prometheus_parser.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "strscan"
|
2
|
+
|
1
3
|
class PrometheusParser
|
2
4
|
class Invalid < StandardError
|
3
5
|
def initialize
|
@@ -6,7 +8,7 @@ class PrometheusParser
|
|
6
8
|
end
|
7
9
|
|
8
10
|
KEY_RE = /[\w:]+/
|
9
|
-
VALUE_RE = /-?\d+\.?\d*E?-?\d*|NaN/
|
11
|
+
VALUE_RE = /-?\d+\.?\d*E?-?\d*|NaN|unknown/
|
10
12
|
ATTR_KEY_RE = /[ \w-]+/
|
11
13
|
ATTR_VALUE_RE = /\s*"([^"\\]*(\\.[^"\\]*)*)"\s*/ # /\s*"(\S*)"\s*/
|
12
14
|
|
@@ -27,6 +29,9 @@ class PrometheusParser
|
|
27
29
|
next
|
28
30
|
end
|
29
31
|
value = s.scan VALUE_RE
|
32
|
+
# Workaround for faulty RabbitMQ metrics exporter
|
33
|
+
# https://github.com/rabbitmq/rabbitmq-server/discussions/5143
|
34
|
+
value = Float::NAN if %w[unknown NaN].include?(value)
|
30
35
|
raise Invalid unless value
|
31
36
|
value = value.to_f
|
32
37
|
s.scan(/\n/)
|
data/prometheus_parser.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus Landerblom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: mange@84codes.com
|