Sha256: 6ce192a8180061864367defccdee9fd8ba33a2c227723a92d7d8883ec1d6ac63

Contents?: true

Size: 350 Bytes

Versions: 5

Compression:

Stored size: 350 Bytes

Contents

# frozen_string_literal: true

class Async::App::Metrics::Store
  include Enumerable

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

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

  private

  def counters = @counters ||= {}
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
async-tools-0.2.7 lib/async/app/metrics/store.rb
async-tools-0.2.6 lib/async/app/metrics/store.rb
async-tools-0.2.5 lib/async/app/metrics/store.rb
async-tools-0.2.4 lib/async/app/metrics/store.rb
async-tools-0.2.2 lib/async/app/metrics/store.rb