Sha256: a6fd7f5efa22a020b227f8227fc24d390fffff69346ecb3f638ac85a4bdab243

Contents?: true

Size: 517 Bytes

Versions: 3

Compression:

Stored size: 517 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 type
        :gauge
      end

      # Sets the value for the given label set
      def set(labels, value)
        unless value.is_a?(Numeric)
          raise ArgumentError, 'value must be a number'
        end

        @values[label_set_for(labels)] = value.to_f
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prometheus-client-0.7.1 lib/prometheus/client/gauge.rb
prometheus-client-0.7.0 lib/prometheus/client/gauge.rb
prometheus-client-0.7.0.pre.rc.1 lib/prometheus/client/gauge.rb