Sha256: 4cff6e7aa74311eb10652965d3b7a6051db6fdf154cb0dcbedc6fc6a2346db84

Contents?: true

Size: 1008 Bytes

Versions: 4

Compression:

Stored size: 1008 Bytes

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'new_relic/agent/transaction/abstract_segment'

module NewRelic
  module Agent
    class Transaction
      class Segment < AbstractSegment
        # unscoped_metrics can be nil, a string, or array. we do this to save
        # object allocations. if allocations weren't important then we would
        # initialize it as an array that would be empty, have one item, or many items.
        attr_reader :unscoped_metrics

        def initialize name = nil, unscoped_metrics=nil
          @unscoped_metrics = unscoped_metrics
          super name
        end

        def record_metrics
          metric_cache.record_scoped_and_unscoped name, duration, exclusive_duration
          if unscoped_metrics
            metric_cache.record_unscoped unscoped_metrics, duration, exclusive_duration
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic_rpm-4.1.0.333 lib/new_relic/agent/transaction/segment.rb
newrelic_rpm-4.0.0.332 lib/new_relic/agent/transaction/segment.rb
newrelic_rpm-3.18.1.330 lib/new_relic/agent/transaction/segment.rb
newrelic_rpm-3.18.0.329 lib/new_relic/agent/transaction/segment.rb