Class: G5PromRails::SettableCounter

Inherits:
Prometheus::Client::Metric
  • Object
show all
Defined in:
lib/g5_prom_rails/settable_counter.rb

Overview

prometheus-client provides a counter that can only be incremented. That works great for instrumenting events, but in the case of something like Sidekiq Processed count, prometheus (the server) can handle resets and all kinds of great stuff if I simply pass the count as-is. Rather than having to monkey with saving the previous value and all that nonsense, I just want to set the value and let the server deal with it.

Instance Method Summary collapse

Instance Method Details

#set(labels, value) ⇒ Object



12
13
14
# File 'lib/g5_prom_rails/settable_counter.rb', line 12

def set(labels, value)
  @values[label_set_for(labels)] = value
end

#typeObject



8
9
10
# File 'lib/g5_prom_rails/settable_counter.rb', line 8

def type
  :counter
end