fluent-plugin-prometheus 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/README.md +1 -0
- data/fluent-plugin-prometheus.gemspec +1 -1
- data/lib/fluent/plugin/in_prometheus_output_monitor.rb +28 -9
- 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: c268ed901a0c48ea1885ce64b621c3abc79983a95696180236156b7844029a4d
|
4
|
+
data.tar.gz: ac9aea40b3eab787f14ba1e402732898ab2cf355a3836d252b85867100914a93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bead7bf6d8534398ef24706348ae55d6437e3b898d89e6edb9981c6311d92be2e6d25f841a6bbf6be973a870966ff1296f3f4fb5314be62d06b900668f51b85
|
7
|
+
data.tar.gz: 8e9d8a48bdb3a3ba73626c01acda706a8af9f6dc309a1c005a240eb3cf051ef50ffe3b0012e966765ba8ffec415b2d2fd4a24852938c7fad84882ee842a96899
|
data/ChangeLog
CHANGED
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 = "1.8.
|
3
|
+
spec.version = "1.8.4"
|
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.}
|
@@ -10,6 +10,7 @@ module Fluent::Plugin
|
|
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 = [
|
@@ -54,6 +55,8 @@ module Fluent::Plugin
|
|
54
55
|
end
|
55
56
|
|
56
57
|
@monitor_agent = Fluent::Plugin::MonitorAgentInput.new
|
58
|
+
|
59
|
+
@gauge_or_counter = @gauge_all ? :gauge : :counter
|
57
60
|
end
|
58
61
|
|
59
62
|
def start
|
@@ -87,28 +90,28 @@ module Fluent::Plugin
|
|
87
90
|
'Oldest timekey in buffer.'),
|
88
91
|
|
89
92
|
# Output metrics
|
90
|
-
retry_counts:
|
93
|
+
retry_counts: get_gauge_or_counter(
|
91
94
|
:fluentd_output_status_retry_count,
|
92
95
|
'Current retry counts.'),
|
93
|
-
num_errors:
|
96
|
+
num_errors: get_gauge_or_counter(
|
94
97
|
:fluentd_output_status_num_errors,
|
95
98
|
'Current number of errors.'),
|
96
|
-
emit_count:
|
99
|
+
emit_count: get_gauge_or_counter(
|
97
100
|
:fluentd_output_status_emit_count,
|
98
101
|
'Current emit counts.'),
|
99
|
-
emit_records:
|
102
|
+
emit_records: get_gauge_or_counter(
|
100
103
|
:fluentd_output_status_emit_records,
|
101
104
|
'Current emit records.'),
|
102
|
-
write_count:
|
105
|
+
write_count: get_gauge_or_counter(
|
103
106
|
:fluentd_output_status_write_count,
|
104
107
|
'Current write counts.'),
|
105
108
|
rollback_count: get_gauge(
|
106
109
|
:fluentd_output_status_rollback_count,
|
107
110
|
'Current rollback counts.'),
|
108
|
-
flush_time_count:
|
111
|
+
flush_time_count: get_gauge_or_counter(
|
109
112
|
:fluentd_output_status_flush_time_count,
|
110
113
|
'Total flush time.'),
|
111
|
-
slow_flush_count:
|
114
|
+
slow_flush_count: get_gauge_or_counter(
|
112
115
|
:fluentd_output_status_slow_flush_count,
|
113
116
|
'Current slow flush counts.'),
|
114
117
|
retry_wait: get_gauge(
|
@@ -157,14 +160,22 @@ module Fluent::Plugin
|
|
157
160
|
|
158
161
|
monitor_info.each do |name, metric|
|
159
162
|
if info[name]
|
160
|
-
metric.
|
163
|
+
if metric.is_a?(::Prometheus::Client::Gauge)
|
164
|
+
metric.set(label, info[name])
|
165
|
+
elsif metric.is_a?(::Prometheus::Client::Counter)
|
166
|
+
metric.increment(label, info[name] - metric.get(label))
|
167
|
+
end
|
161
168
|
end
|
162
169
|
end
|
163
170
|
|
164
171
|
if info['instance_variables']
|
165
172
|
instance_vars_info.each do |name, metric|
|
166
173
|
if info['instance_variables'][name]
|
167
|
-
metric.
|
174
|
+
if metric.is_a?(::Prometheus::Client::Gauge)
|
175
|
+
metric.set(label, info['instance_variables'][name])
|
176
|
+
elsif metric.is_a?(::Prometheus::Client::Counter)
|
177
|
+
metric.increment(label, info['instance_variables'][name] - metric.get(label))
|
178
|
+
end
|
168
179
|
end
|
169
180
|
end
|
170
181
|
end
|
@@ -201,5 +212,13 @@ module Fluent::Plugin
|
|
201
212
|
@registry.gauge(name, docstring)
|
202
213
|
end
|
203
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)
|
221
|
+
end
|
222
|
+
end
|
204
223
|
end
|
205
224
|
end
|
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.8.
|
4
|
+
version: 1.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Sano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|