Class: Fluent::Plugin::PrometheusFilter

Inherits:
Filter
  • Object
show all
Includes:
Prometheus
Defined in:
lib/fluent/plugin/filter_prometheus.rb

Instance Method Summary collapse

Methods included from Prometheus

#instrument, parse_labels_elements, parse_metrics_elements, placeholder_expander

Constructor Details

#initializePrometheusFilter

Returns a new instance of PrometheusFilter.



9
10
11
12
# File 'lib/fluent/plugin/filter_prometheus.rb', line 9

def initialize
  super
  @registry = ::Prometheus::Client.registry
end

Instance Method Details

#configure(conf) ⇒ Object



14
15
16
17
18
# File 'lib/fluent/plugin/filter_prometheus.rb', line 14

def configure(conf)
  super
  labels = Fluent::Plugin::Prometheus.parse_labels_elements(conf)
  @metrics = Fluent::Plugin::Prometheus.parse_metrics_elements(conf, @registry, labels)
end

#filter_stream(tag, es) ⇒ Object



20
21
22
23
# File 'lib/fluent/plugin/filter_prometheus.rb', line 20

def filter_stream(tag, es)
  instrument(tag, es, @metrics)
  es
end