Sha256: 7a495ae48fee2346d3c8cbd32750a45df09e2dad958de4349769fe38a8e457fc

Contents?: true

Size: 899 Bytes

Versions: 26

Compression:

Stored size: 899 Bytes

Contents

# encoding: UTF-8

require 'prometheus/client/metric'

module Prometheus
  module Client
    # A Gauge is a metric that exposes merely an instantaneous value or some
    # snapshot thereof.
    class Gauge < Metric
      def initialize(name, docstring, base_labels = {}, multiprocess_mode=:all)
        super(name, docstring, base_labels)
        if value_class.multiprocess and ![:min, :max, :livesum, :liveall, :all].include?(multiprocess_mode)
          raise ArgumentError, 'Invalid multiprocess mode: ' + multiprocess_mode
        end
        @multiprocess_mode = multiprocess_mode
      end

      def type
        :gauge
      end

      def default(labels)
        value_object(type, @name, @name, labels, @multiprocess_mode)
      end

      # Sets the value for the given label set
      def set(labels, value)
        @values[label_set_for(labels)].set(value)
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
prometheus-client-mmap-0.7.0.beta34 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta33 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta32 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta31 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta30 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta29 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta28 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta27 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta26 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta25 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta24 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta23 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta22 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta21 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta20 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta19 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta18 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta17 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta16 lib/prometheus/client/gauge.rb
prometheus-client-mmap-0.7.0.beta15 lib/prometheus/client/gauge.rb