fluent-plugin-prometheus 1.8.1 → 1.8.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f48e673585638a68fa128172db768d7f35035a04f4d55bb98737e7cfd5d7cdf2
4
- data.tar.gz: 1030ddd92d55c5e6603e49933760eadac266f5081cbb54169b0ebc237bcfe933
3
+ metadata.gz: 6be199d6eb3693d4fe35be96961c05475a667ce8a7fe4b344fb6c5f7c269e820
4
+ data.tar.gz: 3cb81f50d84773da036d7bafadfa41c05928a7fb062310eeea0eea6546382900
5
5
  SHA512:
6
- metadata.gz: adb129f3a83c6be98247e2180d6cb26037a1e8e32e10c555232cf9d267867b4b5b6d5168adebbb9b8ed16b1193c9ff7e8879b379ccb92406b66cb2abc67075e1
7
- data.tar.gz: 2e7a8eecf131d31d08266507620939f7f9b73613d39009d6c2349bbb166b778dae82baa6ea84021793b5374c1372b5cd0673b126ec5b6981c9dfd368c8da0922
6
+ metadata.gz: fc05d9f8283546700cc401c771d5444470e806fd4193cc47f661e01fd91bcd402ac2b0aa7fd52f2fa92ff5811f76d19aca378e3ae9919b93de27bca8e0300581
7
+ data.tar.gz: e614db8e23a6dad5a0d416b224e49ca1895b641b4b0d41933954d709080344f90cb79bc51869533d0efc43e93422dd401e4b547fa85ea316fa1f13457236933f
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Release 1.8.2 - 2020/07/17
2
+
3
+ * in_prometheus_output_monitor/in_prometheus_tail_monitor: Support USR2 reload
4
+
1
5
  Release 1.8.1 - 2020/07/06
2
6
 
3
7
  * Fix aggregate bug with async-http
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "fluent-plugin-prometheus"
3
- spec.version = "1.8.1"
3
+ spec.version = "1.8.2"
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.}
@@ -1,9 +1,9 @@
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
 
@@ -53,12 +53,7 @@ module Fluent::Plugin
53
53
  @base_labels[key] = expander.expand(value)
54
54
  end
55
55
 
56
- if defined?(Fluent::Plugin) && defined?(Fluent::Plugin::MonitorAgentInput)
57
- # from v0.14.6
58
- @monitor_agent = Fluent::Plugin::MonitorAgentInput.new
59
- else
60
- @monitor_agent = Fluent::MonitorAgentInput.new
61
- end
56
+ @monitor_agent = Fluent::Plugin::MonitorAgentInput.new
62
57
  end
63
58
 
64
59
  def start
@@ -66,57 +61,57 @@ module Fluent::Plugin
66
61
 
67
62
  @metrics = {
68
63
  # Buffer metrics
69
- buffer_total_queued_size: @registry.gauge(
64
+ buffer_total_queued_size: get_gauge(
70
65
  :fluentd_output_status_buffer_total_bytes,
71
66
  'Current total size of stage and queue buffers.'),
72
- buffer_stage_length: @registry.gauge(
67
+ buffer_stage_length: get_gauge(
73
68
  :fluentd_output_status_buffer_stage_length,
74
69
  'Current length of stage buffers.'),
75
- buffer_stage_byte_size: @registry.gauge(
70
+ buffer_stage_byte_size: get_gauge(
76
71
  :fluentd_output_status_buffer_stage_byte_size,
77
72
  'Current total size of stage buffers.'),
78
- buffer_queue_length: @registry.gauge(
73
+ buffer_queue_length: get_gauge(
79
74
  :fluentd_output_status_buffer_queue_length,
80
75
  'Current length of queue buffers.'),
81
- buffer_queue_byte_size: @registry.gauge(
76
+ buffer_queue_byte_size: get_gauge(
82
77
  :fluentd_output_status_queue_byte_size,
83
78
  'Current total size of queue buffers.'),
84
- buffer_available_buffer_space_ratios: @registry.gauge(
79
+ buffer_available_buffer_space_ratios: get_gauge(
85
80
  :fluentd_output_status_buffer_available_space_ratio,
86
81
  'Ratio of available space in buffer.'),
87
- buffer_newest_timekey: @registry.gauge(
82
+ buffer_newest_timekey: get_gauge(
88
83
  :fluentd_output_status_buffer_newest_timekey,
89
84
  'Newest timekey in buffer.'),
90
- buffer_oldest_timekey: @registry.gauge(
85
+ buffer_oldest_timekey: get_gauge(
91
86
  :fluentd_output_status_buffer_oldest_timekey,
92
87
  'Oldest timekey in buffer.'),
93
88
 
94
89
  # Output metrics
95
- retry_counts: @registry.gauge(
90
+ retry_counts: get_gauge(
96
91
  :fluentd_output_status_retry_count,
97
92
  'Current retry counts.'),
98
- num_errors: @registry.gauge(
93
+ num_errors: get_gauge(
99
94
  :fluentd_output_status_num_errors,
100
95
  'Current number of errors.'),
101
- emit_count: @registry.gauge(
96
+ emit_count: get_gauge(
102
97
  :fluentd_output_status_emit_count,
103
98
  'Current emit counts.'),
104
- emit_records: @registry.gauge(
99
+ emit_records: get_gauge(
105
100
  :fluentd_output_status_emit_records,
106
101
  'Current emit records.'),
107
- write_count: @registry.gauge(
102
+ write_count: get_gauge(
108
103
  :fluentd_output_status_write_count,
109
104
  'Current write counts.'),
110
- rollback_count: @registry.gauge(
105
+ rollback_count: get_gauge(
111
106
  :fluentd_output_status_rollback_count,
112
107
  'Current rollback counts.'),
113
- flush_time_count: @registry.gauge(
108
+ flush_time_count: get_gauge(
114
109
  :fluentd_output_status_flush_time_count,
115
110
  'Total flush time.'),
116
- slow_flush_count: @registry.gauge(
111
+ slow_flush_count: get_gauge(
117
112
  :fluentd_output_status_slow_flush_count,
118
113
  'Current slow flush counts.'),
119
- retry_wait: @registry.gauge(
114
+ retry_wait: get_gauge(
120
115
  :fluentd_output_status_retry_wait,
121
116
  'Current retry wait'),
122
117
  }
@@ -198,5 +193,13 @@ module Fluent::Plugin
198
193
  type: plugin_info["type"],
199
194
  )
200
195
  end
196
+
197
+ def get_gauge(name, docstring)
198
+ if @registry.exist?(name)
199
+ @registry.get(name)
200
+ else
201
+ @registry.gauge(name, docstring)
202
+ end
203
+ end
201
204
  end
202
205
  end
@@ -38,22 +38,17 @@ module Fluent::Plugin
38
38
  @base_labels[key] = expander.expand(value)
39
39
  end
40
40
 
41
- if defined?(Fluent::Plugin) && defined?(Fluent::Plugin::MonitorAgentInput)
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: @registry.gauge(
48
+ position: get_gauge(
54
49
  :fluentd_tail_file_position,
55
50
  'Current position of file.'),
56
- inode: @registry.gauge(
51
+ inode: get_gauge(
57
52
  :fluentd_tail_file_inode,
58
53
  'Current inode of file.'),
59
54
  }
@@ -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)
95
+ end
96
+ end
94
97
  end
95
98
  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.1
4
+ version: 1.8.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: 2020-07-05 00:00:00.000000000 Z
11
+ date: 2020-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd