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