Sha256: c90779d97e404857898d56452262103d1244e2f55ffcc1849ed79bd077aaf443
Contents?: true
Size: 482 Bytes
Versions: 25
Compression:
Stored size: 482 Bytes
Contents
# frozen_string_literal: true module PrometheusExporter::Metric class Counter < Base attr_reader :data def initialize(name, help) super @data = {} end def type "counter" end def metric_text @data.map do |labels, value| "#{prefix(@name)}#{labels_text(labels)} #{value}" end.join("\n") end def observe(increment = 1, labels = {}) @data[labels] ||= 0 @data[labels] += increment end end end
Version data entries
25 entries across 25 versions & 1 rubygems