fluent-plugin-prometheus 1.7.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/linux.yml +32 -0
- data/ChangeLog +39 -0
- data/README.md +28 -4
- data/fluent-plugin-prometheus.gemspec +3 -3
- data/lib/fluent/plugin/in_prometheus.rb +147 -81
- data/lib/fluent/plugin/in_prometheus/async_wrapper.rb +47 -0
- data/lib/fluent/plugin/in_prometheus_monitor.rb +19 -11
- data/lib/fluent/plugin/in_prometheus_output_monitor.rb +62 -31
- data/lib/fluent/plugin/in_prometheus_tail_monitor.rb +16 -13
- data/lib/fluent/plugin/prometheus.rb +36 -23
- data/lib/fluent/plugin/prometheus/placeholder_expander.rb +132 -0
- data/spec/fluent/plugin/filter_prometheus_spec.rb +20 -10
- data/spec/fluent/plugin/in_prometheus_monitor_spec.rb +0 -1
- data/spec/fluent/plugin/in_prometheus_spec.rb +225 -0
- data/spec/fluent/plugin/in_prometheus_tail_monitor_spec.rb +42 -0
- data/spec/fluent/plugin/out_prometheus_spec.rb +43 -9
- data/spec/fluent/plugin/prometheus/placeholder_expander_spec.rb +110 -0
- data/spec/fluent/plugin/shared.rb +58 -110
- metadata +19 -11
- data/spec/fluent/plugin/prometheus_spec.rb +0 -101
@@ -6,7 +6,11 @@ require_relative 'shared'
|
|
6
6
|
describe Fluent::Plugin::PrometheusOutput do
|
7
7
|
let(:tag) { 'prometheus.test' }
|
8
8
|
let(:driver) { Fluent::Test::Driver::Output.new(Fluent::Plugin::PrometheusOutput).configure(config) }
|
9
|
-
let(:registry) { ::Prometheus::Client.
|
9
|
+
let(:registry) { ::Prometheus::Client::Registry.new }
|
10
|
+
|
11
|
+
before do
|
12
|
+
allow(Prometheus::Client).to receive(:registry).and_return(registry)
|
13
|
+
end
|
10
14
|
|
11
15
|
describe '#configure' do
|
12
16
|
it_behaves_like 'output configuration'
|
@@ -14,18 +18,48 @@ describe Fluent::Plugin::PrometheusOutput do
|
|
14
18
|
|
15
19
|
describe '#run' do
|
16
20
|
let(:message) { {"foo" => 100, "bar" => 100, "baz" => 100, "qux" => 10} }
|
17
|
-
let(:es) {
|
18
|
-
driver.run(default_tag: tag) { driver.feed(event_time, message) }
|
19
|
-
driver.events
|
20
|
-
}
|
21
21
|
|
22
22
|
context 'simple config' do
|
23
|
-
|
23
|
+
let(:config) {
|
24
|
+
BASE_CONFIG + %(
|
25
|
+
<metric>
|
26
|
+
name simple
|
27
|
+
type counter
|
28
|
+
desc Something foo.
|
29
|
+
key foo
|
30
|
+
</metric>
|
31
|
+
)
|
32
|
+
}
|
33
|
+
|
34
|
+
it 'adds a new counter metric' do
|
35
|
+
expect(registry.metrics.map(&:name)).not_to eq([:simple])
|
36
|
+
driver.run(default_tag: tag) { driver.feed(event_time, message) }
|
37
|
+
expect(registry.metrics.map(&:name)).to eq([:simple])
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it_behaves_like 'instruments record'
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#run with symbolized keys' do
|
45
|
+
let(:message) { {:foo => 100, :bar => 100, :baz => 100, :qux => 10} }
|
46
|
+
|
47
|
+
context 'simple config' do
|
48
|
+
let(:config) {
|
49
|
+
BASE_CONFIG + %(
|
50
|
+
<metric>
|
51
|
+
name simple
|
52
|
+
type counter
|
53
|
+
desc Something foo.
|
54
|
+
key foo
|
55
|
+
</metric>
|
56
|
+
)
|
57
|
+
}
|
24
58
|
|
25
59
|
it 'adds a new counter metric' do
|
26
|
-
expect(registry.metrics.map(&:name)).not_to
|
27
|
-
|
28
|
-
expect(registry.metrics.map(&:name)).to
|
60
|
+
expect(registry.metrics.map(&:name)).not_to eq([:simple])
|
61
|
+
driver.run(default_tag: tag) { driver.feed(event_time, message) }
|
62
|
+
expect(registry.metrics.map(&:name)).to eq([:simple])
|
29
63
|
end
|
30
64
|
end
|
31
65
|
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'fluent/plugin/prometheus/placeholder_expander'
|
5
|
+
require_relative '../shared'
|
6
|
+
|
7
|
+
describe Fluent::Plugin::Prometheus::ExpandBuilder::PlaceholderExpander do
|
8
|
+
let(:log) do
|
9
|
+
Logger.new('/dev/null')
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:builder) do
|
13
|
+
Fluent::Plugin::Prometheus::ExpandBuilder.new(log: log)
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '#expand' do
|
17
|
+
context 'with static placeholder' do
|
18
|
+
let(:static_placeholder) do
|
19
|
+
{
|
20
|
+
'hostname' => 'host_value',
|
21
|
+
'tag' => '1.2.3',
|
22
|
+
'ary_value' => ['1', '2', '3'],
|
23
|
+
'hash_value' => { 'key1' => 'val1' },
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
let(:dynamic_placeholder) do
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'expands values' do
|
31
|
+
expander = builder.build(static_placeholder)
|
32
|
+
expect(expander.expand('${hostname}')).to eq('host_value')
|
33
|
+
expect(expander.expand('${ary_value[0]}.${ary_value[1]}.${ary_value[2]}')).to eq('1.2.3')
|
34
|
+
expect(expander.expand('${ary_value[-3]}.${ary_value[-2]}.${ary_value[-1]}')).to eq('1.2.3')
|
35
|
+
expect(expander.expand('${hash_value["key1"]}')).to eq('val1')
|
36
|
+
|
37
|
+
expect(expander.expand('${tag}')).to eq('1.2.3')
|
38
|
+
expect(expander.expand('${tag_parts[0]}.${tag_parts[1]}.${tag_parts[2]}')).to eq('1.2.3')
|
39
|
+
expect(expander.expand('${tag_parts[-3]}.${tag_parts[-2]}.${tag_parts[-1]}')).to eq('1.2.3')
|
40
|
+
expect(expander.expand('${tag_prefix[0]}.${tag_prefix[1]}.${tag_prefix[2]}')).to eq('1.1.2.1.2.3')
|
41
|
+
expect(expander.expand('${tag_suffix[0]}.${tag_suffix[1]}.${tag_suffix[2]}')).to eq('3.2.3.1.2.3')
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'does not create new expander' do
|
45
|
+
builder # cached before mock
|
46
|
+
|
47
|
+
expect(Fluent::Plugin::Prometheus::ExpandBuilder).to receive(:build).with(anything, log: anything).never
|
48
|
+
expander = builder.build(static_placeholder)
|
49
|
+
expander.expand('${hostname}')
|
50
|
+
expander.expand('${hostname}')
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when not found placeholder' do
|
54
|
+
it 'prints wanring log and as it is' do
|
55
|
+
expect(log).to receive(:warn).with('unknown placeholder `${tag_prefix[100]}` found').once
|
56
|
+
|
57
|
+
expander = builder.build(static_placeholder)
|
58
|
+
expect(expander.expand('${tag_prefix[100]}')).to eq('${tag_prefix[100]}')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'with dynamic placeholder' do
|
64
|
+
let(:static_placeholder) do
|
65
|
+
{
|
66
|
+
'hostname' => 'host_value',
|
67
|
+
'ary_value' => ['1', '2', '3'],
|
68
|
+
'hash_value' => { 'key1' => 'val1' },
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
let(:dynamic_placeholder) do
|
73
|
+
{ 'tag' => '1.2.3'}
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'expands values' do
|
77
|
+
expander = builder.build(static_placeholder)
|
78
|
+
expect(expander.expand('${hostname}', dynamic_placeholders: dynamic_placeholder)).to eq('host_value')
|
79
|
+
expect(expander.expand('${ary_value[0]}.${ary_value[1]}.${ary_value[2]}', dynamic_placeholders: dynamic_placeholder)).to eq('1.2.3')
|
80
|
+
expect(expander.expand('${ary_value[-3]}.${ary_value[-2]}.${ary_value[-1]}', dynamic_placeholders: dynamic_placeholder)).to eq('1.2.3')
|
81
|
+
expect(expander.expand('${hash_value["key1"]}', dynamic_placeholders: dynamic_placeholder)).to eq('val1')
|
82
|
+
|
83
|
+
expect(expander.expand('${tag}', dynamic_placeholders: dynamic_placeholder)).to eq('1.2.3')
|
84
|
+
expect(expander.expand('${tag_parts[0]}.${tag_parts[1]}.${tag_parts[2]}', dynamic_placeholders: dynamic_placeholder)).to eq('1.2.3')
|
85
|
+
expect(expander.expand('${tag_parts[-3]}.${tag_parts[-2]}.${tag_parts[-1]}', dynamic_placeholders: dynamic_placeholder)).to eq('1.2.3')
|
86
|
+
expect(expander.expand('${tag_prefix[0]}.${tag_prefix[1]}.${tag_prefix[2]}', dynamic_placeholders: dynamic_placeholder)).to eq('1.1.2.1.2.3')
|
87
|
+
expect(expander.expand('${tag_suffix[0]}.${tag_suffix[1]}.${tag_suffix[2]}', dynamic_placeholders: dynamic_placeholder)).to eq('3.2.3.1.2.3')
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'does not create expander twice if given the same placeholder' do
|
91
|
+
builder # cached before mock
|
92
|
+
|
93
|
+
expect(Fluent::Plugin::Prometheus::ExpandBuilder).to receive(:build).with(anything, log: anything).once.and_call_original
|
94
|
+
expander = builder.build(static_placeholder)
|
95
|
+
placeholder = { 'tag' => 'val.test' }
|
96
|
+
expander.expand('${hostname}', dynamic_placeholders: placeholder)
|
97
|
+
expander.expand('${hostname}', dynamic_placeholders: placeholder)
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'creates new expander for each placeholder' do
|
101
|
+
builder # cached before mock
|
102
|
+
|
103
|
+
expect(Fluent::Plugin::Prometheus::ExpandBuilder).to receive(:build).with(anything, log: anything).twice.and_call_original
|
104
|
+
expander = builder.build(static_placeholder)
|
105
|
+
expander.expand('${hostname}', dynamic_placeholders: { 'tag' => 'val.test' })
|
106
|
+
expander.expand('${hostname}', dynamic_placeholders: { 'tag' => 'val.test2' })
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -1,11 +1,9 @@
|
|
1
1
|
|
2
2
|
BASE_CONFIG = %[
|
3
|
-
type prometheus
|
3
|
+
@type prometheus
|
4
4
|
]
|
5
5
|
|
6
|
-
|
7
6
|
SIMPLE_CONFIG = BASE_CONFIG + %[
|
8
|
-
type prometheus
|
9
7
|
<metric>
|
10
8
|
name simple_foo
|
11
9
|
type counter
|
@@ -111,109 +109,65 @@ COUNTER_WITHOUT_KEY_CONFIG = BASE_CONFIG + %[
|
|
111
109
|
</metric>
|
112
110
|
]
|
113
111
|
|
114
|
-
def gen_time_suffix
|
115
|
-
return Time.now.to_f.to_s.gsub('.', '')
|
116
|
-
end
|
117
|
-
|
118
|
-
shared_context 'simple_config' do
|
119
|
-
let(:orig_name) { 'simple_foo' }
|
120
|
-
let(:config) { SIMPLE_CONFIG.gsub(orig_name, name.to_s) }
|
121
|
-
let(:name) { "#{orig_name}_#{gen_time_suffix}".to_sym }
|
122
|
-
let(:counter) { registry.get(name) }
|
123
|
-
end
|
124
|
-
|
125
|
-
shared_context 'full_config' do
|
126
|
-
let(:config) { FULL_CONFIG }
|
127
|
-
let(:counter) { registry.get(:full_foo) }
|
128
|
-
let(:gauge) { registry.get(:full_bar) }
|
129
|
-
let(:summary) { registry.get(:full_baz) }
|
130
|
-
let(:histogram) { registry.get(:full_qux) }
|
131
|
-
let(:summary_with_accessor) { registry.get(:full_accessor1) }
|
132
|
-
let(:counter_with_accessor) { registry.get(:full_accessor2) }
|
133
|
-
end
|
134
|
-
|
135
|
-
shared_context 'placeholder_config' do
|
136
|
-
let(:orig_name) { 'placeholder_foo' }
|
137
|
-
let(:config) { PLACEHOLDER_CONFIG.gsub(orig_name, name.to_s) }
|
138
|
-
let(:name) { "#{orig_name}_#{gen_time_suffix}".to_sym }
|
139
|
-
let(:counter) { registry.get(name) }
|
140
|
-
end
|
141
|
-
|
142
|
-
shared_context 'accessor_config' do
|
143
|
-
let(:orig_name) { 'accessor_foo' }
|
144
|
-
let(:config) { ACCESSOR_CONFIG.gsub(orig_name, name.to_s) }
|
145
|
-
let(:name) { "#{orig_name}_#{gen_time_suffix}".to_sym }
|
146
|
-
let(:counter) { registry.get(name) }
|
147
|
-
end
|
148
|
-
|
149
|
-
shared_context 'counter_without_key_config' do
|
150
|
-
let(:orig_name) { 'without_key_foo' }
|
151
|
-
let(:config) { COUNTER_WITHOUT_KEY_CONFIG.gsub(orig_name, name.to_s) }
|
152
|
-
let(:name) { "#{orig_name}_#{gen_time_suffix}".to_sym }
|
153
|
-
let(:counter) { registry.get(name) }
|
154
|
-
end
|
155
|
-
|
156
112
|
shared_examples_for 'output configuration' do
|
157
113
|
context 'base config' do
|
158
114
|
let(:config) { BASE_CONFIG }
|
159
|
-
it
|
160
|
-
expect{driver}.not_to raise_error
|
161
|
-
end
|
115
|
+
it { expect { driver }.not_to raise_error }
|
162
116
|
end
|
163
117
|
|
164
|
-
|
165
|
-
|
166
|
-
it { expect{driver}.not_to raise_error }
|
118
|
+
context 'with simple configuration' do
|
119
|
+
let(:config) { SIMPLE_CONFIG }
|
120
|
+
it { expect { driver }.not_to raise_error }
|
167
121
|
end
|
168
122
|
|
169
|
-
|
170
|
-
|
171
|
-
it { expect{driver}.not_to raise_error }
|
123
|
+
context 'with full configuration' do
|
124
|
+
let(:config) { FULL_CONFIG }
|
125
|
+
it { expect { driver }.not_to raise_error }
|
172
126
|
end
|
173
127
|
|
174
|
-
|
175
|
-
|
176
|
-
it { expect{driver}.not_to raise_error }
|
128
|
+
context 'with placeholder configuration' do
|
129
|
+
let(:config) { PLACEHOLDER_CONFIG }
|
130
|
+
it { expect { driver }.not_to raise_error }
|
177
131
|
end
|
178
132
|
|
179
|
-
|
180
|
-
|
181
|
-
it { expect{driver}.not_to raise_error }
|
133
|
+
context 'with accessor configuration' do
|
134
|
+
let(:config) { ACCESSOR_CONFIG }
|
135
|
+
it { expect { driver }.not_to raise_error }
|
182
136
|
end
|
183
137
|
|
184
|
-
describe '
|
185
|
-
|
186
|
-
it { expect{driver}.not_to raise_error }
|
138
|
+
describe 'with counter without key configuration' do
|
139
|
+
let(:config) { COUNTER_WITHOUT_KEY_CONFIG }
|
140
|
+
it { expect { driver }.not_to raise_error }
|
187
141
|
end
|
188
142
|
|
189
|
-
context 'unknown type' do
|
190
|
-
let(:config)
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
expect{driver}.to raise_error Fluent::ConfigError
|
143
|
+
context 'with unknown type' do
|
144
|
+
let(:config) do
|
145
|
+
BASE_CONFIG + %[
|
146
|
+
<metric>
|
147
|
+
type foo
|
148
|
+
</metric>
|
149
|
+
]
|
197
150
|
end
|
151
|
+
it { expect { driver }.to raise_error(Fluent::ConfigError) }
|
198
152
|
end
|
199
153
|
end
|
200
154
|
|
201
|
-
emit_count = 0
|
202
155
|
shared_examples_for 'instruments record' do
|
203
|
-
|
204
|
-
|
156
|
+
before do
|
157
|
+
driver.run(default_tag: tag) { driver.feed(event_time, message) }
|
158
|
+
end
|
205
159
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
160
|
+
context 'full config' do
|
161
|
+
let(:config) { FULL_CONFIG }
|
162
|
+
let(:counter) { registry.get(:full_foo) }
|
163
|
+
let(:gauge) { registry.get(:full_bar) }
|
164
|
+
let(:summary) { registry.get(:full_baz) }
|
165
|
+
let(:histogram) { registry.get(:full_qux) }
|
166
|
+
let(:summary_with_accessor) { registry.get(:full_accessor1) }
|
167
|
+
let(:counter_with_accessor) { registry.get(:full_accessor2) }
|
210
168
|
|
211
169
|
it 'adds all metrics' do
|
212
|
-
expect(registry.metrics.map(&:name)).to
|
213
|
-
expect(registry.metrics.map(&:name)).to include(:full_bar)
|
214
|
-
expect(registry.metrics.map(&:name)).to include(:full_baz)
|
215
|
-
expect(registry.metrics.map(&:name)).to include(:full_accessor1)
|
216
|
-
expect(registry.metrics.map(&:name)).to include(:full_accessor2)
|
170
|
+
expect(registry.metrics.map(&:name)).to eq(%i[full_foo full_bar full_baz full_qux full_accessor1 full_accessor2])
|
217
171
|
expect(counter).to be_kind_of(::Prometheus::Client::Metric)
|
218
172
|
expect(gauge).to be_kind_of(::Prometheus::Client::Metric)
|
219
173
|
expect(summary).to be_kind_of(::Prometheus::Client::Metric)
|
@@ -224,38 +178,38 @@ shared_examples_for 'instruments record' do
|
|
224
178
|
|
225
179
|
it 'instruments counter metric' do
|
226
180
|
expect(counter.type).to eq(:counter)
|
227
|
-
expect(counter.get({test_key: 'test_value', key: 'foo1'})).to be_kind_of(Numeric)
|
228
|
-
expect(counter_with_accessor.get({test_key: 'test_value', key: 'foo6'})).to be_kind_of(Numeric)
|
181
|
+
expect(counter.get(labels: {test_key: 'test_value', key: 'foo1'})).to be_kind_of(Numeric)
|
182
|
+
expect(counter_with_accessor.get(labels: {test_key: 'test_value', key: 'foo6'})).to be_kind_of(Numeric)
|
229
183
|
end
|
230
184
|
|
231
185
|
it 'instruments gauge metric' do
|
232
186
|
expect(gauge.type).to eq(:gauge)
|
233
|
-
expect(gauge.get({test_key: 'test_value', key: 'foo2'})).to eq(100)
|
187
|
+
expect(gauge.get(labels: {test_key: 'test_value', key: 'foo2'})).to eq(100)
|
234
188
|
end
|
235
189
|
|
236
190
|
it 'instruments summary metric' do
|
237
191
|
expect(summary.type).to eq(:summary)
|
238
|
-
expect(summary.get({test_key: 'test_value', key: 'foo3'})).to be_kind_of(Hash)
|
239
|
-
expect(
|
240
|
-
expect(summary_with_accessor.get({test_key: 'test_value', key: 'foo5'})[0.99]).to eq(100)
|
192
|
+
expect(summary.get(labels: {test_key: 'test_value', key: 'foo3'})).to be_kind_of(Hash)
|
193
|
+
expect(summary_with_accessor.get(labels: {test_key: 'test_value', key: 'foo5'})["sum"]).to eq(100)
|
241
194
|
end
|
242
195
|
|
243
196
|
it 'instruments histogram metric' do
|
197
|
+
driver.run(default_tag: tag) do
|
198
|
+
4.times { driver.feed(event_time, message) }
|
199
|
+
end
|
200
|
+
|
244
201
|
expect(histogram.type).to eq(:histogram)
|
245
|
-
expect(histogram.get({test_key: 'test_value', key: 'foo4'})).to be_kind_of(Hash)
|
246
|
-
expect(histogram.get({test_key: 'test_value', key: 'foo4'})[10]).to eq(
|
202
|
+
expect(histogram.get(labels: {test_key: 'test_value', key: 'foo4'})).to be_kind_of(Hash)
|
203
|
+
expect(histogram.get(labels: {test_key: 'test_value', key: 'foo4'})["10"]).to eq(5) # 4 + `es` in before
|
247
204
|
end
|
248
205
|
end
|
249
206
|
|
250
207
|
context 'placeholder config' do
|
251
|
-
|
252
|
-
|
253
|
-
before :each do
|
254
|
-
es
|
255
|
-
end
|
208
|
+
let(:config) { PLACEHOLDER_CONFIG }
|
209
|
+
let(:counter) { registry.get(:placeholder_foo) }
|
256
210
|
|
257
211
|
it 'expands placeholders with record values' do
|
258
|
-
expect(registry.metrics.map(&:name)).to
|
212
|
+
expect(registry.metrics.map(&:name)).to eq([:placeholder_foo])
|
259
213
|
expect(counter).to be_kind_of(::Prometheus::Client::Metric)
|
260
214
|
key, _ = counter.values.find {|k,v| v == 100 }
|
261
215
|
expect(key).to be_kind_of(Hash)
|
@@ -268,30 +222,24 @@ shared_examples_for 'instruments record' do
|
|
268
222
|
end
|
269
223
|
|
270
224
|
context 'accessor config' do
|
271
|
-
|
272
|
-
|
273
|
-
before :each do
|
274
|
-
es
|
275
|
-
end
|
225
|
+
let(:config) { ACCESSOR_CONFIG }
|
226
|
+
let(:counter) { registry.get(:accessor_foo) }
|
276
227
|
|
277
228
|
it 'expands accessor with record values' do
|
278
|
-
expect(registry.metrics.map(&:name)).to
|
229
|
+
expect(registry.metrics.map(&:name)).to eq([:accessor_foo])
|
279
230
|
expect(counter).to be_kind_of(::Prometheus::Client::Metric)
|
280
231
|
key, _ = counter.values.find {|k,v| v == 100 }
|
281
232
|
expect(key).to be_kind_of(Hash)
|
282
|
-
expect(key[:foo]).to eq(100)
|
233
|
+
expect(key[:foo]).to eq("100")
|
283
234
|
end
|
284
235
|
end
|
285
236
|
|
286
237
|
context 'counter_without config' do
|
287
|
-
|
288
|
-
|
289
|
-
before :each do
|
290
|
-
es
|
291
|
-
end
|
238
|
+
let(:config) { COUNTER_WITHOUT_KEY_CONFIG }
|
239
|
+
let(:counter) { registry.get(:without_key_foo) }
|
292
240
|
|
293
241
|
it 'just increments by 1' do
|
294
|
-
expect(registry.metrics.map(&:name)).to
|
242
|
+
expect(registry.metrics.map(&:name)).to eq([:without_key_foo])
|
295
243
|
expect(counter).to be_kind_of(::Prometheus::Client::Metric)
|
296
244
|
_, value = counter.values.find {|k,v| k == {} }
|
297
245
|
expect(value).to eq(1)
|
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:
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Sano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.9.1
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '2'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 1.9.1
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2'
|
@@ -34,16 +34,16 @@ dependencies:
|
|
34
34
|
name: prometheus-client
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
39
|
+
version: 2.1.0
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 2.1.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,9 +107,11 @@ executables: []
|
|
107
107
|
extensions: []
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
|
+
- ".github/workflows/linux.yml"
|
110
111
|
- ".gitignore"
|
111
112
|
- ".rspec"
|
112
113
|
- ".travis.yml"
|
114
|
+
- ChangeLog
|
113
115
|
- Gemfile
|
114
116
|
- LICENSE
|
115
117
|
- README.md
|
@@ -117,11 +119,13 @@ files:
|
|
117
119
|
- fluent-plugin-prometheus.gemspec
|
118
120
|
- lib/fluent/plugin/filter_prometheus.rb
|
119
121
|
- lib/fluent/plugin/in_prometheus.rb
|
122
|
+
- lib/fluent/plugin/in_prometheus/async_wrapper.rb
|
120
123
|
- lib/fluent/plugin/in_prometheus_monitor.rb
|
121
124
|
- lib/fluent/plugin/in_prometheus_output_monitor.rb
|
122
125
|
- lib/fluent/plugin/in_prometheus_tail_monitor.rb
|
123
126
|
- lib/fluent/plugin/out_prometheus.rb
|
124
127
|
- lib/fluent/plugin/prometheus.rb
|
128
|
+
- lib/fluent/plugin/prometheus/placeholder_expander.rb
|
125
129
|
- lib/fluent/plugin/prometheus_metrics.rb
|
126
130
|
- misc/fluentd_sample.conf
|
127
131
|
- misc/nginx_proxy.conf
|
@@ -129,9 +133,11 @@ files:
|
|
129
133
|
- misc/prometheus_alerts.yaml
|
130
134
|
- spec/fluent/plugin/filter_prometheus_spec.rb
|
131
135
|
- spec/fluent/plugin/in_prometheus_monitor_spec.rb
|
136
|
+
- spec/fluent/plugin/in_prometheus_spec.rb
|
137
|
+
- spec/fluent/plugin/in_prometheus_tail_monitor_spec.rb
|
132
138
|
- spec/fluent/plugin/out_prometheus_spec.rb
|
139
|
+
- spec/fluent/plugin/prometheus/placeholder_expander_spec.rb
|
133
140
|
- spec/fluent/plugin/prometheus_metrics_spec.rb
|
134
|
-
- spec/fluent/plugin/prometheus_spec.rb
|
135
141
|
- spec/fluent/plugin/shared.rb
|
136
142
|
- spec/spec_helper.rb
|
137
143
|
homepage: https://github.com/fluent/fluent-plugin-prometheus
|
@@ -153,15 +159,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
159
|
- !ruby/object:Gem::Version
|
154
160
|
version: '0'
|
155
161
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.2.22
|
157
163
|
signing_key:
|
158
164
|
specification_version: 4
|
159
165
|
summary: A fluent plugin that collects metrics and exposes for Prometheus.
|
160
166
|
test_files:
|
161
167
|
- spec/fluent/plugin/filter_prometheus_spec.rb
|
162
168
|
- spec/fluent/plugin/in_prometheus_monitor_spec.rb
|
169
|
+
- spec/fluent/plugin/in_prometheus_spec.rb
|
170
|
+
- spec/fluent/plugin/in_prometheus_tail_monitor_spec.rb
|
163
171
|
- spec/fluent/plugin/out_prometheus_spec.rb
|
172
|
+
- spec/fluent/plugin/prometheus/placeholder_expander_spec.rb
|
164
173
|
- spec/fluent/plugin/prometheus_metrics_spec.rb
|
165
|
-
- spec/fluent/plugin/prometheus_spec.rb
|
166
174
|
- spec/fluent/plugin/shared.rb
|
167
175
|
- spec/spec_helper.rb
|