Class: Prometheus::Client::Counter

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

Overview

Counter is a metric that exposes merely a sum or tally of things.

Instance Attribute Summary

Attributes inherited from Metric

#base_labels, #docstring, #name

Instance Method Summary collapse

Methods inherited from Metric

#get, #initialize, #values

Constructor Details

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

Instance Method Details

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



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

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

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



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

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

#typeObject



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

def type
  :counter
end