fluent-plugin-prometheus-smarter 1.8.11 → 1.8.12

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: 4e4cc7e79d09136b27ab301ac0a4ad0ee66fc4699d6afc89017212ada0d7f57d
4
- data.tar.gz: ebc59a2b2f23266f54e1f33f30e27202625846af12a163090305b1c860b0b324
3
+ metadata.gz: ea00296664f93726bb84de157acf0d1cad2c29bb4490f6e342e9778ddb5918ef
4
+ data.tar.gz: c4825dd44804ce93817560b2e28dc8bc5204da3de7e328c966fabd17ccc3c238
5
5
  SHA512:
6
- metadata.gz: da7634d3fa4c41dd14b783537568e5ac00d0c388907252d54fd3a9c71a08c64a51aeb94e6d56614288ac5a2c29948adf667a0445adf91d99530da190439de8e8
7
- data.tar.gz: a0c02219cbe8f2e0705b15f96f70417ee01132bd55d384afab53c96c1ba31bbd57bc5722fe6b0d075c1560157cbbb61142c6da5ad6a642621636f8e5394213fe
6
+ metadata.gz: 3047e71b3e7bc4a3c9d4dc618447c7d79b9ff41da52524d63cb39cb4779a5e63e4ddff59c73f7cf769712d22f35a1645652d7c0b82f8461313ede02b7696e719
7
+ data.tar.gz: 91a1a387a7a4300535c82fd39e140bc77536854b861f7f3932f50e60061754c371f4796a7f1c2164febe355955ad8b3f0b631f9a18e6667e521877d3121f7c63
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "fluent-plugin-prometheus-smarter"
3
- spec.version = "1.8.11"
3
+ spec.version = "1.8.12"
4
4
  spec.authors = ["Masahiro Sano", "Josh Minor"]
5
5
  spec.email = ["jishminor@gmail.com"]
6
6
  spec.summary = %q{A fluent plugin that collects metrics and exposes for Prometheus.}
@@ -1,5 +1,6 @@
1
1
  require 'fluent/plugin/output'
2
2
  require 'fluent/plugin/prometheus'
3
+ require 'fluent/plugin/prometheus/placeholder_expander'
3
4
 
4
5
  module Fluent::Plugin
5
6
  class PrometheusOutputMetric < Fluent::Plugin::Output
@@ -18,7 +19,7 @@ module Fluent::Plugin
18
19
 
19
20
  config_param :key, :string
20
21
 
21
- def labels(record, expander)
22
+ def labels(labels, record, expander)
22
23
  label = {}
23
24
  labels.each do |k, v|
24
25
  if v.is_a?(String)
@@ -30,15 +31,11 @@ module Fluent::Plugin
30
31
  label
31
32
  end
32
33
 
33
- def self.placeholder_expander(log)
34
- Fluent::Plugin::Prometheus::ExpandBuilder.new(log: log)
35
- end
36
-
37
34
  def configure(conf)
38
35
  super
39
36
  @labels = parse_labels_elements(conf)
40
37
  @placeholder_values = {}
41
- @placeholder_expander_builder = Fluent::Plugin::PrometheusOutputMetric.placeholder_expander(log)
38
+ @placeholder_expander_builder = Fluent::Plugin::Prometheus.placeholder_expander(log)
42
39
  end
43
40
 
44
41
  def process(tag, es)
@@ -56,15 +53,14 @@ module Fluent::Plugin
56
53
  rescue ::Prometheus::Client::Registry::AlreadyRegisteredError
57
54
  gauge = @registry.get(tag.to_sym)
58
55
  end
59
- placeholders = record.merge(placeholder_values)
60
- expander = @placeholder_expander_builder.build(placeholders)
56
+ expander = @placeholder_expander_builder.build(placeholder_values)
61
57
  if @key.is_a?(String)
62
58
  value = record[@key]
63
59
  else
64
60
  value = @key.call(record)
65
61
  end
66
62
  if value
67
- gauge.set(labels(record, expander), value)
63
+ gauge.set(labels(@labels, record, expander), value)
68
64
  end
69
65
  end
70
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-prometheus-smarter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.11
4
+ version: 1.8.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Sano