fluent-plugin-prometheus 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 274c9ef3f67ca084c8b46d6a24ca97ce8313d2ade4409426dc2bb664ec227f31
4
- data.tar.gz: 1c3cc72e17e834cf5144315086856bc8a8394a1a893771f7521e0a0fd4adf73f
3
+ metadata.gz: 80f51eb873f6e3a90a0e68b0afbeb92c1efefbf5a5336dda94aea65e78227adb
4
+ data.tar.gz: 5182614c1617d843d584e749c8402e6c70f17cf09376ea1f9adcc8dd6901074a
5
5
  SHA512:
6
- metadata.gz: 791e3bf0e513d98d32f0bb8a0f936e305f373ae2706fd9ad6bd3cdd12eb9adcd288d811ea3bcc9eb06c50b7eb583ec5edda3fb52751f7def52252c1174780407
7
- data.tar.gz: 2aa16a95bedb91f4f04bac51a8fe96ee540aefe13532429d12803f97f0537e9fd3c10bb54a37c8145f8a58fe0e06e7975d7e99e1a8addb686eb12311ab9951c5
6
+ metadata.gz: 62fe2b113f75baef5bb2e5e452d64b8f1d5734edacbf7989c164b959666fb2515a26d7800299c46a0121acd71a2a091d436d45baa3d53b105dc436839a8fb635
7
+ data.tar.gz: 5296bfc10750933363b2d08b79d55617d4edc65a4a7a55be4a4cd9fefb3515b1f44175b61f5f4e1ae49a8048cb2856bbbab54377be8272eb2029a2d891ebf91e
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "fluent-plugin-prometheus"
3
- spec.version = "1.3.0"
3
+ spec.version = "1.4.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.}
@@ -11,6 +11,10 @@ module Fluent::Plugin
11
11
  @registry = ::Prometheus::Client.registry
12
12
  end
13
13
 
14
+ def multi_workers_ready?
15
+ true
16
+ end
17
+
14
18
  def configure(conf)
15
19
  super
16
20
  labels = Fluent::Plugin::Prometheus.parse_labels_elements(conf)
@@ -27,9 +27,10 @@ module Fluent::Plugin
27
27
  placeholders = expander.prepare_placeholders({'hostname' => hostname, 'worker_id' => fluentd_worker_id})
28
28
  @base_labels = Fluent::Plugin::Prometheus.parse_labels_elements(conf)
29
29
  @base_labels.each do |key, value|
30
- if value.is_a?(String)
31
- @base_labels[key] = expander.expand(value, placeholders)
30
+ unless value.is_a?(String)
31
+ raise Fluent::ConfigError, "record accessor syntax is not available in prometheus_monitor"
32
32
  end
33
+ @base_labels[key] = expander.expand(value, placeholders)
33
34
  end
34
35
 
35
36
  if defined?(Fluent::Plugin) && defined?(Fluent::Plugin::MonitorAgentInput)
@@ -39,6 +40,11 @@ module Fluent::Plugin
39
40
  @monitor_agent = Fluent::MonitorAgentInput.new
40
41
  end
41
42
 
43
+ end
44
+
45
+ def start
46
+ super
47
+
42
48
  buffer_queue_length = @registry.gauge(
43
49
  :fluentd_status_buffer_queue_length,
44
50
  'Current buffer queue length.')
@@ -54,10 +60,6 @@ module Fluent::Plugin
54
60
  'buffer_total_queued_size' => buffer_total_queued_size,
55
61
  'retry_count' => retry_counts,
56
62
  }
57
- end
58
-
59
- def start
60
- super
61
63
  timer_execute(:in_prometheus_monitor, @interval, &method(:update_monitor_info))
62
64
  end
63
65
 
@@ -42,6 +42,9 @@ module Fluent::Plugin
42
42
  placeholders = expander.prepare_placeholders({'hostname' => hostname, 'worker_id' => fluentd_worker_id})
43
43
  @base_labels = Fluent::Plugin::Prometheus.parse_labels_elements(conf)
44
44
  @base_labels.each do |key, value|
45
+ unless value.is_a?(String)
46
+ raise Fluent::ConfigError, "record accessor syntax is not available in prometheus_output_monitor"
47
+ end
45
48
  @base_labels[key] = expander.expand(value, placeholders)
46
49
  end
47
50
 
@@ -51,6 +54,10 @@ module Fluent::Plugin
51
54
  else
52
55
  @monitor_agent = Fluent::MonitorAgentInput.new
53
56
  end
57
+ end
58
+
59
+ def start
60
+ super
54
61
 
55
62
  @metrics = {
56
63
  buffer_queue_length: @registry.gauge(
@@ -81,10 +88,6 @@ module Fluent::Plugin
81
88
  :fluentd_output_status_retry_wait,
82
89
  'Current retry wait'),
83
90
  }
84
- end
85
-
86
- def start
87
- super
88
91
  timer_execute(:in_prometheus_output_monitor, @interval, &method(:update_monitor_info))
89
92
  end
90
93
 
@@ -31,6 +31,9 @@ module Fluent::Plugin
31
31
  placeholders = expander.prepare_placeholders({'hostname' => hostname, 'worker_id' => fluentd_worker_id})
32
32
  @base_labels = Fluent::Plugin::Prometheus.parse_labels_elements(conf)
33
33
  @base_labels.each do |key, value|
34
+ unless value.is_a?(String)
35
+ raise Fluent::ConfigError, "record accessor syntax is not available in prometheus_tail_monitor"
36
+ end
34
37
  @base_labels[key] = expander.expand(value, placeholders)
35
38
  end
36
39
 
@@ -40,6 +43,10 @@ module Fluent::Plugin
40
43
  else
41
44
  @monitor_agent = Fluent::MonitorAgentInput.new
42
45
  end
46
+ end
47
+
48
+ def start
49
+ super
43
50
 
44
51
  @metrics = {
45
52
  position: @registry.gauge(
@@ -49,10 +56,6 @@ module Fluent::Plugin
49
56
  :fluentd_tail_file_inode,
50
57
  'Current inode of file.'),
51
58
  }
52
- end
53
-
54
- def start
55
- super
56
59
  timer_execute(:in_prometheus_tail_monitor, @interval, &method(:update_monitor_info))
57
60
  end
58
61
 
@@ -11,6 +11,10 @@ module Fluent::Plugin
11
11
  @registry = ::Prometheus::Client.registry
12
12
  end
13
13
 
14
+ def multi_workers_ready?
15
+ true
16
+ end
17
+
14
18
  def configure(conf)
15
19
  super
16
20
  labels = Fluent::Plugin::Prometheus.parse_labels_elements(conf)
@@ -8,8 +8,17 @@ describe Fluent::Plugin::PrometheusMonitorInput do
8
8
  <labels>
9
9
  host ${hostname}
10
10
  foo bar
11
- no_effect1 $.foo.bar
12
- no_effect2 $[0][1]
11
+ </labels>
12
+ ]
13
+
14
+ INVALID_MONITOR_CONFIG = %[
15
+ @type prometheus_monitor
16
+
17
+ <labels>
18
+ host ${hostname}
19
+ foo bar
20
+ invalid_use1 $.foo.bar
21
+ invalid_use2 $[0][1]
13
22
  </labels>
14
23
  ]
15
24
 
@@ -18,8 +27,17 @@ describe Fluent::Plugin::PrometheusMonitorInput do
18
27
  let(:driver) { Fluent::Test::Driver::Input.new(Fluent::Plugin::PrometheusMonitorInput).configure(config) }
19
28
 
20
29
  describe '#configure' do
21
- it 'does not raise error' do
22
- expect{driver}.not_to raise_error
30
+ describe 'valid' do
31
+ it 'does not raise error' do
32
+ expect{driver}.not_to raise_error
33
+ end
34
+ end
35
+
36
+ describe 'invalid' do
37
+ let(:config) { INVALID_MONITOR_CONFIG }
38
+ it 'expect raise error' do
39
+ expect{driver}.to raise_error
40
+ end
23
41
  end
24
42
  end
25
43
  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.3.0
4
+ version: 1.4.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: 2019-01-05 00:00:00.000000000 Z
11
+ date: 2019-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd