Sha256: 77e95e68e1d104162e90d2b8eada2d8a6370e3fbbbb87b88a6a883d64abf6d3a
Contents?: true
Size: 1.08 KB
Versions: 158
Compression:
Stored size: 1.08 KB
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 def increment(labels, value) @values[label_set_for(labels)].increment(value) end def decrement(labels, value) @values[label_set_for(labels)].decrement(value) end end end end
Version data entries
158 entries across 158 versions & 2 rubygems