Class: Prometheus::Client::Counter

Inherits:
Metric
  • Object
show all
Defined in:
lib/prometheus/client/counter.rb

Instance Method Summary collapse

Methods inherited from Metric

#get, #initialize, #to_json

Constructor Details

This class inherits a constructor from Prometheus::Client::Metric

Instance Method Details

#decrement(labels = {}, by = 1) ⇒ Object



15
16
17
# File 'lib/prometheus/client/counter.rb', line 15

def decrement(labels = {}, by = 1)
  increment(labels, -by)
end

#increment(labels = {}, by = 1) ⇒ Object



10
11
12
13
# File 'lib/prometheus/client/counter.rb', line 10

def increment(labels = {}, by = 1)
  label_set = label_set_for(labels)
  synchronize { @values[label_set] += by }
end

#typeObject



6
7
8
# File 'lib/prometheus/client/counter.rb', line 6

def type
  :counter
end