Sha256: cd5cb24f3d122472c80b0357e8502120331660ae8be4d2cc7a10244831984ae5

Contents?: true

Size: 667 Bytes

Versions: 10

Compression:

Stored size: 667 Bytes

Contents

module Nanoc::Telemetry
  class LabelledSummary
    def initialize
      @summaries = {}
    end

    def observe(value, label)
      get(label).observe(value)
    end

    def get(label)
      @summaries.fetch(label) { @summaries[label] = Summary.new }
    end

    def empty?
      @summaries.empty?
    end

    def quantile(fraction, label)
      get(label).quantile(fraction)
    end

    def map
      @summaries.map { |(label, summary)| yield(label, summary) }
    end

    # TODO: add quantiles(fraction)
    # TODO: add min(label)
    # TODO: add mins
    # TODO: add max(label)
    # TODO: add maxs
    # TODO: add sum(label)
    # TODO: add sums
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
nanoc-4.7.9 lib/nanoc/telemetry/labelled_summary.rb
nanoc-4.7.8 lib/nanoc/telemetry/labelled_summary.rb
nanoc-4.7.7 lib/nanoc/telemetry/labelled_summary.rb
nanoc-4.7.6 lib/nanoc/telemetry/labelled_summary.rb
nanoc-4.7.5 lib/nanoc/telemetry/labelled_summary.rb
nanoc-4.7.4 lib/nanoc/telemetry/labelled_summary.rb
nanoc-4.7.3 lib/nanoc/telemetry/labelled_summary.rb
nanoc-4.7.2 lib/nanoc/telemetry/labelled_summary.rb
nanoc-4.7.1 lib/nanoc/telemetry/labelled_summary.rb
nanoc-4.7.0 lib/nanoc/telemetry/labelled_summary.rb