fluent-plugin-prometheus-smarter 1.8.4 → 1.8.5
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 +3 -3
- metadata +5 -6
- data/lib/fluent/plugin/metric_prometheus.rb +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c2cda69af325db41ca82963d27f977bf9f538292722d45081ee679db4beceb1
|
4
|
+
data.tar.gz: 39972b2ffe7e899412df2906979e6477acd5f794cad39dfe5cefdb6b5f2919c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4758adde70167f804d93c031105127db3993fa9a1a02620543f9cc183aacc7587e2dd4bcac4cabb35b48c2ea149f3aa42a0d86ce72a08256d13ff6e1df1dffc
|
7
|
+
data.tar.gz: 8569c124ee96a4c88868ab1fe601c96e49b3d12fa01046c3331d996c39207f421d572d1e0d14975db27075215f58e0fea3e694aa8a8a3b393ef98b2383967e43
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "fluent-plugin-prometheus-smarter"
|
3
|
-
spec.version = "1.8.
|
4
|
-
spec.authors = ["Masahiro Sano
|
3
|
+
spec.version = "1.8.5"
|
4
|
+
spec.authors = ["Masahiro Sano, Josh Minor"]
|
5
5
|
spec.email = ["sabottenda@gmail.com"]
|
6
6
|
spec.summary = %q{A fluent plugin that collects metrics and exposes for Prometheus.}
|
7
7
|
spec.description = %q{A fluent plugin that collects metrics and exposes for Prometheus.}
|
8
|
-
spec.homepage = "https://github.com/
|
8
|
+
spec.homepage = "https://github.com/fluent/fluent-plugin-prometheus"
|
9
9
|
spec.license = "Apache-2.0"
|
10
10
|
|
11
11
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,11 +1,10 @@
|
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Masahiro Sano
|
8
|
-
- Josh Minor
|
7
|
+
- Masahiro Sano, Josh Minor
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
@@ -121,7 +120,6 @@ files:
|
|
121
120
|
- lib/fluent/plugin/in_prometheus_monitor.rb
|
122
121
|
- lib/fluent/plugin/in_prometheus_output_monitor.rb
|
123
122
|
- lib/fluent/plugin/in_prometheus_tail_monitor.rb
|
124
|
-
- lib/fluent/plugin/metric_prometheus.rb
|
125
123
|
- lib/fluent/plugin/out_prometheus.rb
|
126
124
|
- lib/fluent/plugin/prometheus.rb
|
127
125
|
- lib/fluent/plugin/prometheus/placeholder_expander.rb
|
@@ -139,7 +137,7 @@ files:
|
|
139
137
|
- spec/fluent/plugin/prometheus_metrics_spec.rb
|
140
138
|
- spec/fluent/plugin/shared.rb
|
141
139
|
- spec/spec_helper.rb
|
142
|
-
homepage: https://github.com/
|
140
|
+
homepage: https://github.com/fluent/fluent-plugin-prometheus
|
143
141
|
licenses:
|
144
142
|
- Apache-2.0
|
145
143
|
metadata: {}
|
@@ -158,7 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
156
|
- !ruby/object:Gem::Version
|
159
157
|
version: '0'
|
160
158
|
requirements: []
|
161
|
-
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 2.7.6
|
162
161
|
signing_key:
|
163
162
|
specification_version: 4
|
164
163
|
summary: A fluent plugin that collects metrics and exposes for Prometheus.
|
@@ -1,71 +0,0 @@
|
|
1
|
-
require 'fluent/plugin/output'
|
2
|
-
require 'fluent/plugin/prometheus'
|
3
|
-
|
4
|
-
module Fluent::Plugin
|
5
|
-
class PrometheusOutput < Fluent::Plugin::Output
|
6
|
-
Fluent::Plugin.register_output('prometheus_metric', self)
|
7
|
-
include Fluent::Plugin::PrometheusLabelParser
|
8
|
-
include Fluent::Plugin::Prometheus
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
super
|
12
|
-
@registry = ::Prometheus::Client.registry
|
13
|
-
end
|
14
|
-
|
15
|
-
def multi_workers_ready?
|
16
|
-
true
|
17
|
-
end
|
18
|
-
|
19
|
-
config_param :key, :string
|
20
|
-
|
21
|
-
def labels(record, expander)
|
22
|
-
label = {}
|
23
|
-
labels.each do |k, v|
|
24
|
-
if v.is_a?(String)
|
25
|
-
label[k] = expander.expand(v)
|
26
|
-
else
|
27
|
-
label[k] = v.call(record)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
label
|
31
|
-
end
|
32
|
-
|
33
|
-
def configure(conf)
|
34
|
-
super
|
35
|
-
@labels = parse_labels_elements(conf)
|
36
|
-
@placeholder_values = {}
|
37
|
-
@placeholder_expander_builder = Fluent::Plugin::Prometheus.placeholder_expander(log)
|
38
|
-
@hostname = Socket.gethostname
|
39
|
-
end
|
40
|
-
|
41
|
-
def process(tag, es)
|
42
|
-
placeholder_values = {
|
43
|
-
'tag' => tag,
|
44
|
-
'hostname' => @hostname,
|
45
|
-
'worker_id' => fluentd_worker_id,
|
46
|
-
}
|
47
|
-
|
48
|
-
# Create metric if not exists
|
49
|
-
begin
|
50
|
-
gauge = registry.gauge(tag.to_sym)
|
51
|
-
rescue ::Prometheus::Client::Registry::AlreadyRegisteredError
|
52
|
-
gauge = registry.get(tag.to_sym)
|
53
|
-
end
|
54
|
-
|
55
|
-
# Write out values in event stream to Registry
|
56
|
-
es.each do |time, record|
|
57
|
-
placeholders = record.merge(placeholder_values)
|
58
|
-
expander = @placeholder_expander_builder.build(placeholders)
|
59
|
-
if @key.is_a?(String)
|
60
|
-
value = record[@key]
|
61
|
-
else
|
62
|
-
value = @key.call(record)
|
63
|
-
end
|
64
|
-
if value
|
65
|
-
gauge.set(labels(record, expander), value)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
end
|