Sha256: 9a1711724205ba1cc75e57cb9457d61e33f939a824434cf6dff9210446f0f3dd

Contents?: true

Size: 357 Bytes

Versions: 1

Compression:

Stored size: 357 Bytes

Contents

# frozen_string_literal: true

class Async::App::WebApps::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

1 entries across 1 versions & 1 rubygems

Version Path
async-tools-0.2.10 lib/async/app/web_apps/metrics_app/store.rb