Sha256: 1e720349c7a007036b72dabbf674c60bee6f93aae8e9779e42e7bde28d3c6c53

Contents?: true

Size: 623 Bytes

Versions: 6

Compression:

Stored size: 623 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 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

6 entries across 6 versions & 1 rubygems

Version Path
fluent-plugin-prometheus-1.3.0 lib/fluent/plugin/filter_prometheus.rb
fluent-plugin-prometheus-1.2.1 lib/fluent/plugin/filter_prometheus.rb
fluent-plugin-prometheus-1.2.0 lib/fluent/plugin/filter_prometheus.rb
fluent-plugin-prometheus-1.1.0 lib/fluent/plugin/filter_prometheus.rb
fluent-plugin-prometheus-1.0.1 lib/fluent/plugin/filter_prometheus.rb
fluent-plugin-prometheus-1.0.0 lib/fluent/plugin/filter_prometheus.rb