fluent-plugin-prometheus 1.8.1 → 2.0.0
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 +26 -0
- data/ChangeLog +20 -0
- data/README.md +1 -0
- data/fluent-plugin-prometheus.gemspec +2 -2
- data/lib/fluent/plugin/in_prometheus/async_wrapper.rb +4 -3
- data/lib/fluent/plugin/in_prometheus_monitor.rb +16 -8
- data/lib/fluent/plugin/in_prometheus_output_monitor.rb +50 -28
- data/lib/fluent/plugin/in_prometheus_tail_monitor.rb +13 -10
- data/lib/fluent/plugin/prometheus.rb +9 -9
- data/spec/fluent/plugin/shared.rb +8 -9
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3250eed2a2f1156410b9e67005f7e23fdb822111dd780690ce61ee4967db7cf
|
4
|
+
data.tar.gz: dd1d3aa0defd1ac16f7d4e6e75dd7b6b7c9caff11f9e16288dc9b787d8f3ef9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed531d2e8e383f54f3ff68c695cb63c0a2922a17ced661a109e50c50546a571aeb45747cba079274b451f41bdd506737d43c035140e28db7e5a427a83a1126b9
|
7
|
+
data.tar.gz: 7fab4fb99f73a770f0a87d88341078f089e78fd865ba28aba4634d04dfa5b5baa7ab8e7b1942fdc5ef96f6306ef379d7da2335bc7856ea150cb69c8749635f94
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: linux
|
2
|
+
on:
|
3
|
+
- push
|
4
|
+
- pull_request
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ${{ matrix.os }}
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby: [ '2.4', '2.5', '2.6', '2.7' ]
|
12
|
+
os:
|
13
|
+
- ubuntu-latest
|
14
|
+
name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }}
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
20
|
+
- name: unit testing
|
21
|
+
env:
|
22
|
+
CI: true
|
23
|
+
run: |
|
24
|
+
gem install bundler rake
|
25
|
+
bundle install --jobs 4 --retry 3
|
26
|
+
bundle exec rake spec
|
data/ChangeLog
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
Release 2.0.0 - 2021/02/18
|
2
|
+
|
3
|
+
* Update prometheus-client dependency to 2.1.0 or later
|
4
|
+
|
5
|
+
Release 1.8.5 - 2020/11/24
|
6
|
+
|
7
|
+
* in_prometheus_monitor: Support USR2 reload
|
8
|
+
|
9
|
+
Release 1.8.4 - 2020/09/24
|
10
|
+
|
11
|
+
* in_prometheus_output_monitor: Add gauge_all parameter
|
12
|
+
|
13
|
+
Release 1.8.3 - 2020/08/24
|
14
|
+
|
15
|
+
* Fix resourcr leak in async-http based server
|
16
|
+
|
17
|
+
Release 1.8.2 - 2020/07/17
|
18
|
+
|
19
|
+
* in_prometheus_output_monitor/in_prometheus_tail_monitor: Support USR2 reload
|
20
|
+
|
1
21
|
Release 1.8.1 - 2020/07/06
|
2
22
|
|
3
23
|
* Fix aggregate bug with async-http
|
data/README.md
CHANGED
@@ -152,6 +152,7 @@ More configuration parameters:
|
|
152
152
|
|
153
153
|
- `<labels>`: additional labels for this metric (optional). See [Labels](#labels)
|
154
154
|
- `interval`: interval to update monitor_agent information in seconds (default: 5)
|
155
|
+
- `gauge_all`: Specify metric type. If `true`, use `gauge` type. If `false`, use `counter` type. Since v2, this parameter will be removed and use `counter` type.
|
155
156
|
|
156
157
|
### prometheus_tail_monitor input plugin
|
157
158
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "fluent-plugin-prometheus"
|
3
|
-
spec.version = "
|
3
|
+
spec.version = "2.0.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.}
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.require_paths = ["lib"]
|
15
15
|
|
16
16
|
spec.add_dependency "fluentd", ">= 1.9.1", "< 2"
|
17
|
-
spec.add_dependency "prometheus-client", "
|
17
|
+
spec.add_dependency "prometheus-client", ">= 2.1.0"
|
18
18
|
spec.add_development_dependency "bundler"
|
19
19
|
spec.add_development_dependency "rake"
|
20
20
|
spec.add_development_dependency "rspec"
|
@@ -13,8 +13,9 @@ module Fluent::Plugin
|
|
13
13
|
Async::HTTP::Endpoint.parse("http://#{host}:#{port}")
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
Async::HTTP::Client.open(endpoint) do |client|
|
17
|
+
yield(AsyncHttpWrapper.new(client))
|
18
|
+
end
|
18
19
|
end
|
19
20
|
|
20
21
|
Response = Struct.new(:code, :body, :headers)
|
@@ -38,7 +39,7 @@ module Fluent::Plugin
|
|
38
39
|
raise error
|
39
40
|
end
|
40
41
|
|
41
|
-
Response.new(response.status.to_s, response.
|
42
|
+
Response.new(response.status.to_s, response.read || '', response.headers)
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
@@ -46,19 +46,19 @@ module Fluent::Plugin
|
|
46
46
|
def start
|
47
47
|
super
|
48
48
|
|
49
|
-
@buffer_newest_timekey =
|
49
|
+
@buffer_newest_timekey = get_gauge(
|
50
50
|
:fluentd_status_buffer_newest_timekey,
|
51
51
|
'Newest timekey in buffer.')
|
52
|
-
@buffer_oldest_timekey =
|
52
|
+
@buffer_oldest_timekey = get_gauge(
|
53
53
|
:fluentd_status_buffer_oldest_timekey,
|
54
54
|
'Oldest timekey in buffer.')
|
55
|
-
buffer_queue_length =
|
55
|
+
buffer_queue_length = get_gauge(
|
56
56
|
:fluentd_status_buffer_queue_length,
|
57
57
|
'Current buffer queue length.')
|
58
|
-
buffer_total_queued_size =
|
58
|
+
buffer_total_queued_size = get_gauge(
|
59
59
|
:fluentd_status_buffer_total_bytes,
|
60
60
|
'Current total size of queued buffers.')
|
61
|
-
retry_counts =
|
61
|
+
retry_counts = get_gauge(
|
62
62
|
:fluentd_status_retry_count,
|
63
63
|
'Current retry counts.')
|
64
64
|
|
@@ -76,14 +76,14 @@ module Fluent::Plugin
|
|
76
76
|
|
77
77
|
@monitor_info.each do |name, metric|
|
78
78
|
if info[name]
|
79
|
-
metric.set(
|
79
|
+
metric.set(info[name], labels: label)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
timekeys = info["buffer_timekeys"]
|
84
84
|
if timekeys && !timekeys.empty?
|
85
|
-
@buffer_newest_timekey.set(
|
86
|
-
@buffer_oldest_timekey.set(
|
85
|
+
@buffer_newest_timekey.set(timekeys.max, labels: label)
|
86
|
+
@buffer_oldest_timekey.set(timekeys.min, labels: label)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -95,5 +95,13 @@ module Fluent::Plugin
|
|
95
95
|
type: plugin_info["type"],
|
96
96
|
)
|
97
97
|
end
|
98
|
+
|
99
|
+
def get_gauge(name, docstring)
|
100
|
+
if @registry.exist?(name)
|
101
|
+
@registry.get(name)
|
102
|
+
else
|
103
|
+
@registry.gauge(name, docstring: docstring, labels: @base_labels.keys + [:plugin_id, :plugin_category, :type])
|
104
|
+
end
|
105
|
+
end
|
98
106
|
end
|
99
107
|
end
|
@@ -1,15 +1,16 @@
|
|
1
|
-
require 'fluent/input'
|
1
|
+
require 'fluent/plugin/input'
|
2
2
|
require 'fluent/plugin/in_monitor_agent'
|
3
3
|
require 'fluent/plugin/prometheus'
|
4
4
|
|
5
5
|
module Fluent::Plugin
|
6
|
-
class PrometheusOutputMonitorInput < Fluent::Input
|
6
|
+
class PrometheusOutputMonitorInput < Fluent::Plugin::Input
|
7
7
|
Fluent::Plugin.register_input('prometheus_output_monitor', self)
|
8
8
|
include Fluent::Plugin::PrometheusLabelParser
|
9
9
|
|
10
10
|
helpers :timer
|
11
11
|
|
12
12
|
config_param :interval, :time, default: 5
|
13
|
+
config_param :gauge_all, :bool, default: true
|
13
14
|
attr_reader :registry
|
14
15
|
|
15
16
|
MONITOR_IVARS = [
|
@@ -53,12 +54,9 @@ module Fluent::Plugin
|
|
53
54
|
@base_labels[key] = expander.expand(value)
|
54
55
|
end
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
else
|
60
|
-
@monitor_agent = Fluent::MonitorAgentInput.new
|
61
|
-
end
|
57
|
+
@monitor_agent = Fluent::Plugin::MonitorAgentInput.new
|
58
|
+
|
59
|
+
@gauge_or_counter = @gauge_all ? :gauge : :counter
|
62
60
|
end
|
63
61
|
|
64
62
|
def start
|
@@ -66,57 +64,57 @@ module Fluent::Plugin
|
|
66
64
|
|
67
65
|
@metrics = {
|
68
66
|
# Buffer metrics
|
69
|
-
buffer_total_queued_size:
|
67
|
+
buffer_total_queued_size: get_gauge(
|
70
68
|
:fluentd_output_status_buffer_total_bytes,
|
71
69
|
'Current total size of stage and queue buffers.'),
|
72
|
-
buffer_stage_length:
|
70
|
+
buffer_stage_length: get_gauge(
|
73
71
|
:fluentd_output_status_buffer_stage_length,
|
74
72
|
'Current length of stage buffers.'),
|
75
|
-
buffer_stage_byte_size:
|
73
|
+
buffer_stage_byte_size: get_gauge(
|
76
74
|
:fluentd_output_status_buffer_stage_byte_size,
|
77
75
|
'Current total size of stage buffers.'),
|
78
|
-
buffer_queue_length:
|
76
|
+
buffer_queue_length: get_gauge(
|
79
77
|
:fluentd_output_status_buffer_queue_length,
|
80
78
|
'Current length of queue buffers.'),
|
81
|
-
buffer_queue_byte_size:
|
79
|
+
buffer_queue_byte_size: get_gauge(
|
82
80
|
:fluentd_output_status_queue_byte_size,
|
83
81
|
'Current total size of queue buffers.'),
|
84
|
-
buffer_available_buffer_space_ratios:
|
82
|
+
buffer_available_buffer_space_ratios: get_gauge(
|
85
83
|
:fluentd_output_status_buffer_available_space_ratio,
|
86
84
|
'Ratio of available space in buffer.'),
|
87
|
-
buffer_newest_timekey:
|
85
|
+
buffer_newest_timekey: get_gauge(
|
88
86
|
:fluentd_output_status_buffer_newest_timekey,
|
89
87
|
'Newest timekey in buffer.'),
|
90
|
-
buffer_oldest_timekey:
|
88
|
+
buffer_oldest_timekey: get_gauge(
|
91
89
|
:fluentd_output_status_buffer_oldest_timekey,
|
92
90
|
'Oldest timekey in buffer.'),
|
93
91
|
|
94
92
|
# Output metrics
|
95
|
-
retry_counts:
|
93
|
+
retry_counts: get_gauge_or_counter(
|
96
94
|
:fluentd_output_status_retry_count,
|
97
95
|
'Current retry counts.'),
|
98
|
-
num_errors:
|
96
|
+
num_errors: get_gauge_or_counter(
|
99
97
|
:fluentd_output_status_num_errors,
|
100
98
|
'Current number of errors.'),
|
101
|
-
emit_count:
|
99
|
+
emit_count: get_gauge_or_counter(
|
102
100
|
:fluentd_output_status_emit_count,
|
103
101
|
'Current emit counts.'),
|
104
|
-
emit_records:
|
102
|
+
emit_records: get_gauge_or_counter(
|
105
103
|
:fluentd_output_status_emit_records,
|
106
104
|
'Current emit records.'),
|
107
|
-
write_count:
|
105
|
+
write_count: get_gauge_or_counter(
|
108
106
|
:fluentd_output_status_write_count,
|
109
107
|
'Current write counts.'),
|
110
|
-
rollback_count:
|
108
|
+
rollback_count: get_gauge(
|
111
109
|
:fluentd_output_status_rollback_count,
|
112
110
|
'Current rollback counts.'),
|
113
|
-
flush_time_count:
|
111
|
+
flush_time_count: get_gauge_or_counter(
|
114
112
|
:fluentd_output_status_flush_time_count,
|
115
113
|
'Total flush time.'),
|
116
|
-
slow_flush_count:
|
114
|
+
slow_flush_count: get_gauge_or_counter(
|
117
115
|
:fluentd_output_status_slow_flush_count,
|
118
116
|
'Current slow flush counts.'),
|
119
|
-
retry_wait:
|
117
|
+
retry_wait: get_gauge(
|
120
118
|
:fluentd_output_status_retry_wait,
|
121
119
|
'Current retry wait'),
|
122
120
|
}
|
@@ -162,14 +160,22 @@ module Fluent::Plugin
|
|
162
160
|
|
163
161
|
monitor_info.each do |name, metric|
|
164
162
|
if info[name]
|
165
|
-
metric.
|
163
|
+
if metric.is_a?(::Prometheus::Client::Gauge)
|
164
|
+
metric.set(info[name], labels: label)
|
165
|
+
elsif metric.is_a?(::Prometheus::Client::Counter)
|
166
|
+
metric.increment(by: info[name] - metric.get(labels: label), labels: label)
|
167
|
+
end
|
166
168
|
end
|
167
169
|
end
|
168
170
|
|
169
171
|
if info['instance_variables']
|
170
172
|
instance_vars_info.each do |name, metric|
|
171
173
|
if info['instance_variables'][name]
|
172
|
-
metric.
|
174
|
+
if metric.is_a?(::Prometheus::Client::Gauge)
|
175
|
+
metric.set(info['instance_variables'][name], labels: label)
|
176
|
+
elsif metric.is_a?(::Prometheus::Client::Counter)
|
177
|
+
metric.increment(by: info['instance_variables'][name] - metric.get(labels: label), labels: label)
|
178
|
+
end
|
173
179
|
end
|
174
180
|
end
|
175
181
|
end
|
@@ -187,7 +193,7 @@ module Fluent::Plugin
|
|
187
193
|
if next_time && start_time
|
188
194
|
wait = next_time - start_time
|
189
195
|
end
|
190
|
-
@metrics[:retry_wait].set(
|
196
|
+
@metrics[:retry_wait].set(wait.to_f, labels: label)
|
191
197
|
end
|
192
198
|
end
|
193
199
|
end
|
@@ -198,5 +204,21 @@ module Fluent::Plugin
|
|
198
204
|
type: plugin_info["type"],
|
199
205
|
)
|
200
206
|
end
|
207
|
+
|
208
|
+
def get_gauge(name, docstring)
|
209
|
+
if @registry.exist?(name)
|
210
|
+
@registry.get(name)
|
211
|
+
else
|
212
|
+
@registry.gauge(name, docstring: docstring, labels: @base_labels.keys + [:plugin_id, :type])
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
def get_gauge_or_counter(name, docstring)
|
217
|
+
if @registry.exist?(name)
|
218
|
+
@registry.get(name)
|
219
|
+
else
|
220
|
+
@registry.public_send(@gauge_or_counter, name, docstring: docstring, labels: @base_labels.keys + [:plugin_id, :type])
|
221
|
+
end
|
222
|
+
end
|
201
223
|
end
|
202
224
|
end
|
@@ -38,22 +38,17 @@ module Fluent::Plugin
|
|
38
38
|
@base_labels[key] = expander.expand(value)
|
39
39
|
end
|
40
40
|
|
41
|
-
|
42
|
-
# from v0.14.6
|
43
|
-
@monitor_agent = Fluent::Plugin::MonitorAgentInput.new
|
44
|
-
else
|
45
|
-
@monitor_agent = Fluent::MonitorAgentInput.new
|
46
|
-
end
|
41
|
+
@monitor_agent = Fluent::Plugin::MonitorAgentInput.new
|
47
42
|
end
|
48
43
|
|
49
44
|
def start
|
50
45
|
super
|
51
46
|
|
52
47
|
@metrics = {
|
53
|
-
position:
|
48
|
+
position: get_gauge(
|
54
49
|
:fluentd_tail_file_position,
|
55
50
|
'Current position of file.'),
|
56
|
-
inode:
|
51
|
+
inode: get_gauge(
|
57
52
|
:fluentd_tail_file_inode,
|
58
53
|
'Current inode of file.'),
|
59
54
|
}
|
@@ -78,8 +73,8 @@ module Fluent::Plugin
|
|
78
73
|
# Very fragile implementation
|
79
74
|
pe = watcher.instance_variable_get(:@pe)
|
80
75
|
label = labels(info, watcher.path)
|
81
|
-
@metrics[:inode].set(
|
82
|
-
@metrics[:position].set(
|
76
|
+
@metrics[:inode].set(pe.read_inode, labels: label)
|
77
|
+
@metrics[:position].set(pe.read_pos, labels: label)
|
83
78
|
end
|
84
79
|
end
|
85
80
|
end
|
@@ -91,5 +86,13 @@ module Fluent::Plugin
|
|
91
86
|
path: path,
|
92
87
|
)
|
93
88
|
end
|
89
|
+
|
90
|
+
def get_gauge(name, docstring)
|
91
|
+
if @registry.exist?(name)
|
92
|
+
@registry.get(name)
|
93
|
+
else
|
94
|
+
@registry.gauge(name, docstring: docstring, labels: @base_labels.keys + [:plugin_id, :type, :path])
|
95
|
+
end
|
96
|
+
end
|
94
97
|
end
|
95
98
|
end
|
@@ -188,7 +188,7 @@ module Fluent
|
|
188
188
|
end
|
189
189
|
|
190
190
|
begin
|
191
|
-
@gauge = registry.gauge(element['name'].to_sym, element['desc'])
|
191
|
+
@gauge = registry.gauge(element['name'].to_sym, docstring: element['desc'], labels: @base_labels.keys)
|
192
192
|
rescue ::Prometheus::Client::Registry::AlreadyRegisteredError
|
193
193
|
@gauge = Fluent::Plugin::Prometheus::Metric.get(registry, element['name'].to_sym, :gauge, element['desc'])
|
194
194
|
end
|
@@ -201,7 +201,7 @@ module Fluent
|
|
201
201
|
value = @key.call(record)
|
202
202
|
end
|
203
203
|
if value
|
204
|
-
@gauge.set(labels(record, expander)
|
204
|
+
@gauge.set(value, labels: labels(record, expander))
|
205
205
|
end
|
206
206
|
end
|
207
207
|
end
|
@@ -210,7 +210,7 @@ module Fluent
|
|
210
210
|
def initialize(element, registry, labels)
|
211
211
|
super
|
212
212
|
begin
|
213
|
-
@counter = registry.counter(element['name'].to_sym, element['desc'])
|
213
|
+
@counter = registry.counter(element['name'].to_sym, docstring: element['desc'], labels: @base_labels.keys)
|
214
214
|
rescue ::Prometheus::Client::Registry::AlreadyRegisteredError
|
215
215
|
@counter = Fluent::Plugin::Prometheus::Metric.get(registry, element['name'].to_sym, :counter, element['desc'])
|
216
216
|
end
|
@@ -229,7 +229,7 @@ module Fluent
|
|
229
229
|
# ignore if record value is nil
|
230
230
|
return if value.nil?
|
231
231
|
|
232
|
-
@counter.increment(labels(record, expander)
|
232
|
+
@counter.increment(by: value, labels: labels(record, expander))
|
233
233
|
end
|
234
234
|
end
|
235
235
|
|
@@ -241,7 +241,7 @@ module Fluent
|
|
241
241
|
end
|
242
242
|
|
243
243
|
begin
|
244
|
-
@summary = registry.summary(element['name'].to_sym, element['desc'])
|
244
|
+
@summary = registry.summary(element['name'].to_sym, docstring: element['desc'], labels: @base_labels.keys)
|
245
245
|
rescue ::Prometheus::Client::Registry::AlreadyRegisteredError
|
246
246
|
@summary = Fluent::Plugin::Prometheus::Metric.get(registry, element['name'].to_sym, :summary, element['desc'])
|
247
247
|
end
|
@@ -254,7 +254,7 @@ module Fluent
|
|
254
254
|
value = @key.call(record)
|
255
255
|
end
|
256
256
|
if value
|
257
|
-
@summary.observe(labels(record, expander)
|
257
|
+
@summary.observe(value, labels: labels(record, expander))
|
258
258
|
end
|
259
259
|
end
|
260
260
|
end
|
@@ -271,9 +271,9 @@ module Fluent
|
|
271
271
|
buckets = element['buckets'].split(/,/).map(&:strip).map do |e|
|
272
272
|
e[/\A\d+.\d+\Z/] ? e.to_f : e.to_i
|
273
273
|
end
|
274
|
-
@histogram = registry.histogram(element['name'].to_sym, element['desc'],
|
274
|
+
@histogram = registry.histogram(element['name'].to_sym, docstring: element['desc'], labels: @base_labels.keys, buckets: buckets)
|
275
275
|
else
|
276
|
-
@histogram = registry.histogram(element['name'].to_sym, element['desc'])
|
276
|
+
@histogram = registry.histogram(element['name'].to_sym, docstring: element['desc'], labels: @base_labels.keys)
|
277
277
|
end
|
278
278
|
rescue ::Prometheus::Client::Registry::AlreadyRegisteredError
|
279
279
|
@histogram = Fluent::Plugin::Prometheus::Metric.get(registry, element['name'].to_sym, :histogram, element['desc'])
|
@@ -287,7 +287,7 @@ module Fluent
|
|
287
287
|
value = @key.call(record)
|
288
288
|
end
|
289
289
|
if value
|
290
|
-
@histogram.observe(labels(record, expander)
|
290
|
+
@histogram.observe(value, labels: labels(record, expander))
|
291
291
|
end
|
292
292
|
end
|
293
293
|
end
|
@@ -178,20 +178,19 @@ shared_examples_for 'instruments record' do
|
|
178
178
|
|
179
179
|
it 'instruments counter metric' do
|
180
180
|
expect(counter.type).to eq(:counter)
|
181
|
-
expect(counter.get({test_key: 'test_value', key: 'foo1'})).to be_kind_of(Numeric)
|
182
|
-
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)
|
183
183
|
end
|
184
184
|
|
185
185
|
it 'instruments gauge metric' do
|
186
186
|
expect(gauge.type).to eq(:gauge)
|
187
|
-
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)
|
188
188
|
end
|
189
189
|
|
190
190
|
it 'instruments summary metric' do
|
191
191
|
expect(summary.type).to eq(:summary)
|
192
|
-
expect(summary.get({test_key: 'test_value', key: 'foo3'})).to be_kind_of(Hash)
|
193
|
-
expect(
|
194
|
-
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)
|
195
194
|
end
|
196
195
|
|
197
196
|
it 'instruments histogram metric' do
|
@@ -200,8 +199,8 @@ shared_examples_for 'instruments record' do
|
|
200
199
|
end
|
201
200
|
|
202
201
|
expect(histogram.type).to eq(:histogram)
|
203
|
-
expect(histogram.get({test_key: 'test_value', key: 'foo4'})).to be_kind_of(Hash)
|
204
|
-
expect(histogram.get({test_key: 'test_value', key: 'foo4'})[10]).to eq(5) # 4 + `es` in before
|
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
|
205
204
|
end
|
206
205
|
end
|
207
206
|
|
@@ -231,7 +230,7 @@ shared_examples_for 'instruments record' do
|
|
231
230
|
expect(counter).to be_kind_of(::Prometheus::Client::Metric)
|
232
231
|
key, _ = counter.values.find {|k,v| v == 100 }
|
233
232
|
expect(key).to be_kind_of(Hash)
|
234
|
-
expect(key[:foo]).to eq(100)
|
233
|
+
expect(key[:foo]).to eq("100")
|
235
234
|
end
|
236
235
|
end
|
237
236
|
|
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.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:
|
11
|
+
date: 2021-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -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,6 +107,7 @@ 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"
|
@@ -158,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
159
|
- !ruby/object:Gem::Version
|
159
160
|
version: '0'
|
160
161
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.1.4
|
162
163
|
signing_key:
|
163
164
|
specification_version: 4
|
164
165
|
summary: A fluent plugin that collects metrics and exposes for Prometheus.
|