Sha256: 6914c7abc3375afa0088e13a199f65aa9549c16eb09421efd8a2815f9f0c2313

Contents?: true

Size: 672 Bytes

Versions: 2

Compression:

Stored size: 672 Bytes

Contents

require 'fluent/plugin/prometheus'
require 'fluent/plugin/filter'

module Fluent::Plugin
  class PrometheusFilter < Fluent::Plugin::Filter
    Fluent::Plugin.register_filter('prometheus', self)
    include Fluent::Plugin::Prometheus

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

    def multi_workers_ready?
      true
    end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-plugin-prometheus-1.5.0 lib/fluent/plugin/filter_prometheus.rb
fluent-plugin-prometheus-1.4.0 lib/fluent/plugin/filter_prometheus.rb