Sha256: 26bd4547b5d27d3821315b827002745325964db3c66770e31a76d965885757e7

Contents?: true

Size: 496 Bytes

Versions: 34

Compression:

Stored size: 496 Bytes

Contents

# frozen_string_literal: true

module Honeycomb
  ##
  # Functionality for including 'rollup_fields'. Which are fields that can be
  # tracked numerically and will also be propogated up to an existing trace.
  #
  module RollupFields
    def rollup_fields
      @rollup_fields ||= Hash.new(0)
    end

    def add_rollup_field(key, value)
      return unless value.is_a? Numeric

      respond_to?(:trace) && trace.add_rollup_field(key, value)
      rollup_fields[key] += value
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
honeycomb-beeline-3.1.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-3.0.1 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-3.0.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.11.1.pre.dev lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.11.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.10.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.9.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.8.2 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.8.1 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.8.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.7.1 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.7.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.6.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.5.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.4.2 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.4.1 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.4.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.3.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.2.0 lib/honeycomb/rollup_fields.rb
honeycomb-beeline-2.1.2 lib/honeycomb/rollup_fields.rb