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, #set, #to_json, #value

Constructor Details

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

Instance Method Details

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



19
20
21
# File 'lib/prometheus/client/counter.rb', line 19

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

#defaultObject



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

def default
  0
end

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



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

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

#typeObject



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

def type
  :counter
end