Sha256: 45e1f05555a4fcbc4862fbf7a35d66a6669e213903b031f5e8b0f67b1e55a0fb

Contents?: true

Size: 654 Bytes

Versions: 7

Compression:

Stored size: 654 Bytes

Contents

# encoding: UTF-8

require 'prometheus/client/metric'

module Prometheus
  module Client
    # Counter is a metric that exposes merely a sum or tally of things.
    class Counter < Metric
      def type
        :counter
      end

      def increment(labels = {}, by = 1, exemplar_name = '', exemplar_value = '')
        raise ArgumentError, 'increment must be a non-negative number' if by < 0

        label_set = label_set_for(labels)
        synchronize { @values[label_set].increment(by, exemplar_name, exemplar_value) }
      end

      private

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vinted-prometheus-client-mmap-1.7.0 lib/prometheus/client/counter.rb
vinted-prometheus-client-mmap-1.7.0-x86_64-linux lib/prometheus/client/counter.rb
vinted-prometheus-client-mmap-1.6.0 lib/prometheus/client/counter.rb
vinted-prometheus-client-mmap-1.6.0-x86_64-linux lib/prometheus/client/counter.rb
vinted-prometheus-client-mmap-1.5.0-x86_64-linux lib/prometheus/client/counter.rb
vinted-prometheus-client-mmap-1.4.0 lib/prometheus/client/counter.rb
vinted-prometheus-client-mmap-1.3.0 lib/prometheus/client/counter.rb