Sha256: 632e352636fa67b8b7372e28ed2535a6413d5c59b1f6e1a0a25185178c13e61e

Contents?: true

Size: 1.75 KB

Versions: 12

Compression:

Stored size: 1.75 KB

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.

module NewRelic
  module Agent
    class Transaction
      module Tracing

        attr_reader :current_segment

        def async?
          @async ||= false
        end

        attr_writer :async

        def total_time
          @total_time ||= 0.0
        end

        attr_writer :total_time

        def add_segment segment, parent = nil
          segment.transaction = self
          segment.parent = parent || current_segment
          @current_segment = segment
          if @segments.length < segment_limit
            @segments << segment
          else
            segment.record_on_finish = true
            ::NewRelic::Agent.logger.debug("Segment limit of #{segment_limit} reached, ceasing collection.")
          end
          segment.transaction_assigned
        end

        def segment_complete segment
          @current_segment = segment.parent
        end

        def segment_limit
          Agent.config[:'transaction_tracer.limit_segments']
        end

        private

        def finalize_segments
          segments.each { |s| s.finalize }
        end


        WEB_TRANSACTION_TOTAL_TIME   = "WebTransactionTotalTime".freeze
        OTHER_TRANSACTION_TOTAL_TIME = "OtherTransactionTotalTime".freeze

        def record_total_time_metrics
          total_time_metric = if recording_web_transaction?
            WEB_TRANSACTION_TOTAL_TIME
          else
            OTHER_TRANSACTION_TOTAL_TIME
          end

          @metrics.record_unscoped total_time_metric, total_time
          @metrics.record_unscoped "#{total_time_metric}/#{@frozen_name}", total_time
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
newrelic_rpm-6.11.0.365 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.10.0.364 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.9.0.363 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.8.0.360 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.7.0.359 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.6.0.358 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.5.0.357 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.4.0.356 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.3.0.355 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.2.0.354 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.1.0.352 lib/new_relic/agent/transaction/tracing.rb
newrelic_rpm-6.0.0.351 lib/new_relic/agent/transaction/tracing.rb