module Fluent::Plugin::PrometheusLabelParser

Public Instance Methods

configure(conf) click to toggle source
Calls superclass method
# File lib/fluent/plugin/prometheus.rb, line 8
def configure(conf)
  super
  # Check if running with multiple workers
  sysconf = if self.respond_to?(:owner) && owner.respond_to?(:system_config)
    owner.system_config
  elsif self.respond_to?(:system_config)
    self.system_config
  else
    nil
  end
  @multi_worker = sysconf && sysconf.workers ? (sysconf.workers > 1) : false
end
parse_labels_elements(conf) click to toggle source
# File lib/fluent/plugin/prometheus.rb, line 21
def parse_labels_elements(conf)
  base_labels = Fluent::Plugin::Prometheus.parse_labels_elements(conf)

  if @multi_worker
    base_labels[:worker_id] = fluentd_worker_id.to_s
  end

  base_labels
end