fluent-plugin-prometheus-smarter 1.8.17 → 1.8.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-prometheus.gemspec +1 -1
- data/lib/fluent/plugin/out_prometheus_metric.rb +3 -30
- 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: 873dae732f73abb5904fddaba9ca3be0fa4b4680f76ac619f7b153a84313c145
|
4
|
+
data.tar.gz: a9e6e352f0c902dcf5f7a6aeb56932c22def54be479de3cac823cbab11976d3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 341a9e8ac04a52914bde8550debdac1cffd5808b795617188d16a64f3c7a46fc129bc15f4eb1b4ec6e048503bb0119f6df276e8be09afc58d192c28091d1b139
|
7
|
+
data.tar.gz: 95698da40d500d8e4ebe874d18509eb8b0c95d311c63e9cd4c0ebfec1ff202e3006d5109023b5c1d873e81277c4ed7b61f005c6dd088703076cff22376ac0ea9
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "fluent-plugin-prometheus-smarter"
|
3
|
-
spec.version = "1.8.
|
3
|
+
spec.version = "1.8.18"
|
4
4
|
spec.authors = ["Masahiro Sano", "Josh Minor"]
|
5
5
|
spec.email = ["jishminor@gmail.com"]
|
6
6
|
spec.summary = %q{A fluent plugin that collects metrics and exposes for Prometheus.}
|
@@ -17,31 +17,7 @@ module Fluent::Plugin
|
|
17
17
|
|
18
18
|
config_param :key, :string
|
19
19
|
|
20
|
-
def labels(labels, record, expander)
|
21
|
-
label = {}
|
22
|
-
labels.each do |k, v|
|
23
|
-
if v.is_a?(String)
|
24
|
-
label[k] = expander.expand(v)
|
25
|
-
else
|
26
|
-
label[k] = v.call(record)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
label
|
30
|
-
end
|
31
|
-
|
32
|
-
def configure(conf)
|
33
|
-
super
|
34
|
-
@labels = parse_labels_elements(conf)
|
35
|
-
@expander_builder = Fluent::Plugin::Prometheus.placeholder_expander(log)
|
36
|
-
end
|
37
|
-
|
38
20
|
def process(tag, es)
|
39
|
-
placeholder_values = {
|
40
|
-
'tag' => tag,
|
41
|
-
'worker_id' => fluentd_worker_id,
|
42
|
-
}
|
43
|
-
expander = @expander_builder.build(placeholder_values)
|
44
|
-
|
45
21
|
# Write out values in event stream to Registry
|
46
22
|
es.each do |time, record|
|
47
23
|
# Create metric if not exists
|
@@ -51,13 +27,10 @@ module Fluent::Plugin
|
|
51
27
|
rescue ::Prometheus::Client::Registry::AlreadyRegisteredError
|
52
28
|
gauge = @registry.get(tag.to_sym)
|
53
29
|
end
|
54
|
-
|
55
|
-
value = record[@key]
|
56
|
-
else
|
57
|
-
value = @key.call(record)
|
58
|
-
end
|
30
|
+
value = record[@key]
|
59
31
|
if value
|
60
|
-
|
32
|
+
# set labels as all elements in message besides the key
|
33
|
+
gauge.set(record.except(@key), value)
|
61
34
|
end
|
62
35
|
end
|
63
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-prometheus-smarter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Sano
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-05-
|
12
|
+
date: 2020-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|