Sha256: 53933f87e660d09be370f83faec2db2a6a45c544fefdc4c81a7dd89a4ea7095d

Contents?: true

Size: 439 Bytes

Versions: 21

Compression:

Stored size: 439 Bytes

Contents

# frozen_string_literal: true

module PrometheusExporter::Metric
  class Gauge < Base
    attr_reader :data

    def initialize(name, help)
      super
      @data = {}
    end

    def type
      "gauge"
    end

    def metric_text
      @data.map do |labels, value|
        "#{prefix(@name)}#{labels_text(labels)} #{value}"
      end.join("\n")
    end

    def observe(value, labels = {})
      @data[labels] = value
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
prometheus_exporter-0.3.3 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.3.1 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.3.0 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.2.0 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.16 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.15 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.14 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.13 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.12 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.11 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.10 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.9 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.8 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.7 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.6 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.5 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.4 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.3 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.2 lib/prometheus_exporter/metric/gauge.rb
prometheus_exporter-0.1.1 lib/prometheus_exporter/metric/gauge.rb