Class: Fluent::Plugin::PrometheusOutput

Inherits:
Output
  • Object
show all
Includes:
Prometheus, PrometheusLabelParser
Defined in:
lib/fluent/plugin/out_prometheus.rb

Instance Method Summary collapse

Methods included from Prometheus

#instrument, #instrument_single, parse_labels_elements, parse_metrics_elements, placeholder_expander, start_retention_threads, #stringify_keys

Methods included from PrometheusLabelParser

#parse_labels_elements

Constructor Details

#initializePrometheusOutput

Returns a new instance of PrometheusOutput.



12
13
14
15
# File 'lib/fluent/plugin/out_prometheus.rb', line 12

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

Instance Method Details

#configure(conf) ⇒ Object



21
22
23
24
25
# File 'lib/fluent/plugin/out_prometheus.rb', line 21

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

#multi_workers_ready?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/fluent/plugin/out_prometheus.rb', line 17

def multi_workers_ready?
  true
end

#process(tag, es) ⇒ Object



38
39
40
# File 'lib/fluent/plugin/out_prometheus.rb', line 38

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

#startObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/fluent/plugin/out_prometheus.rb', line 27

def start
  super
  Fluent::Plugin::Prometheus.start_retention_threads(
    @metrics,
    @registry,
    method(:thread_create),
    method(:thread_current_running?),
    @log
  )
end