fluent-plugin-prometheus 1.6.1 → 1.7.0
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/filter_prometheus.rb +3 -3
- data/lib/fluent/plugin/prometheus.rb +20 -0
- 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: 95008f0031db355e5a5bbf4ed21f8f9f0a07839480e40bf44e974046b04f562f
|
4
|
+
data.tar.gz: 994a30da7b1ff0ad77f12e5b47d9218a2deb97effc31a36fa83175077cc6ed69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0dc26e78e242e51e0fa87257b85c68af2ae32c11f7dabd1b4245e3ad7e1b1a7182b1b8432578f98af8a5a22d14c14e664285a238f74ebc40df0c0461026f323
|
7
|
+
data.tar.gz: fb31a79f327ce31e8203fa1fa9a5b9d9166410d71f9b62d4fd5411d246c768dfde5c9c076ff6e72f0d9f5bd4c7657c9180eb91ba4ee383729856da0704930404
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "fluent-plugin-prometheus"
|
3
|
-
spec.version = "1.
|
3
|
+
spec.version = "1.7.0"
|
4
4
|
spec.authors = ["Masahiro Sano"]
|
5
5
|
spec.email = ["sabottenda@gmail.com"]
|
6
6
|
spec.summary = %q{A fluent plugin that collects metrics and exposes for Prometheus.}
|
@@ -22,9 +22,9 @@ module Fluent::Plugin
|
|
22
22
|
@metrics = Fluent::Plugin::Prometheus.parse_metrics_elements(conf, @registry, labels)
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
|
27
|
-
|
25
|
+
def filter(tag, time, record)
|
26
|
+
instrument_single(tag, time, record, @metrics)
|
27
|
+
record
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -88,10 +88,30 @@ module Fluent
|
|
88
88
|
|
89
89
|
def configure(conf)
|
90
90
|
super
|
91
|
+
@placeholder_values = {}
|
91
92
|
@placeholder_expander = Fluent::Plugin::Prometheus.placeholder_expander(log)
|
92
93
|
@hostname = Socket.gethostname
|
93
94
|
end
|
94
95
|
|
96
|
+
def instrument_single(tag, time, record, metrics)
|
97
|
+
@placeholder_values[tag] ||= {
|
98
|
+
'tag' => tag,
|
99
|
+
'hostname' => @hostname,
|
100
|
+
'worker_id' => fluentd_worker_id,
|
101
|
+
}
|
102
|
+
|
103
|
+
placeholders = record.merge(@placeholder_values[tag])
|
104
|
+
placeholders = @placeholder_expander.prepare_placeholders(placeholders)
|
105
|
+
metrics.each do |metric|
|
106
|
+
begin
|
107
|
+
metric.instrument(record, @placeholder_expander, placeholders)
|
108
|
+
rescue => e
|
109
|
+
log.warn "prometheus: failed to instrument a metric.", error_class: e.class, error: e, tag: tag, name: metric.name
|
110
|
+
router.emit_error_event(tag, time, record, e)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
95
115
|
def instrument(tag, es, metrics)
|
96
116
|
placeholder_values = {
|
97
117
|
'tag' => tag,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-prometheus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Sano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|