Sha256: 08d3bf505b0b22187a27377c0fdd44b09a5edb8f05750a2100b4f7eeddb93d14
Contents?: true
Size: 475 Bytes
Versions: 1
Compression:
Stored size: 475 Bytes
Contents
module TwemproxyExporter class Counter def initialize(registry, name, desc) @counter = Prometheus::Client::Counter.new(name, desc) registry.register(@counter) @last = 0 end def count(value, labels = {}) if value >= @last @counter.increment(labels, value - @last) else @counter.increment(labels, value) end @last = value end def value(labels = {}) @counter.get(labels) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
twemproxy_exporter-0.1.1 | lib/twemproxy_exporter/counter.rb |