Sha256: 4eed1f7bd6011402e96ef4718f50be204594d8729ddfe79515eb5089f1a2a78f

Contents?: true

Size: 359 Bytes

Versions: 2

Compression:

Stored size: 359 Bytes

Contents

# frozen_string_literal: true

class Async::App::WebServer::MetricsApp::Store
  include Enumerable

  def set(name, value:, suffix: "total", **labels)
    key = [name, labels]
    metrics[key] ||= { name:, labels:, suffix:, value: }
    metrics[key].merge!(value:)
  end

  def each(&) = metrics.values.each(&)

  private

  def metrics = @metrics ||= {}
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
async-tools-0.2.9 lib/async/app/web_server/metrics_app/store.rb
async-tools-0.2.8 lib/async/app/web_server/metrics_app/store.rb