Sha256: 4a071aedb981d48ff6a38ab6e7c68d305e01c7d16814b75ef4003ccd22cf6c28

Contents?: true

Size: 474 Bytes

Versions: 15

Compression:

Stored size: 474 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(by: 1, labels: {})
        raise ArgumentError, 'increment must be a non-negative number' if by < 0

        label_set = label_set_for(labels)
        @store.increment(labels: label_set, by: by)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
prometheus-client-4.2.3 lib/prometheus/client/counter.rb
vm-client-1.0.0 lib/prometheus/client/counter.rb
prometheus-client-4.2.2 lib/prometheus/client/counter.rb
prometheus-client-4.2.1 lib/prometheus/client/counter.rb
prometheus-client-4.2.0 lib/prometheus/client/counter.rb
prometheus-client-4.1.0 lib/prometheus/client/counter.rb
prometheus-client-4.0.0 lib/prometheus/client/counter.rb
prometheus-client-3.0.0 lib/prometheus/client/counter.rb
prometheus-client-2.1.0 lib/prometheus/client/counter.rb
prometheus-client-2.0.0 lib/prometheus/client/counter.rb
prometheus-client-1.0.0 lib/prometheus/client/counter.rb
prometheus-client-0.11.0.pre.alpha.1 lib/prometheus/client/counter.rb
prometheus-client-0.10.0 lib/prometheus/client/counter.rb
prometheus-client-0.10.0.pre.alpha.2 lib/prometheus/client/counter.rb
prometheus-client-0.10.0.pre.alpha.1 lib/prometheus/client/counter.rb