Sha256: 3461e23170c438cafa7358b99929b617ab8bac5e4fac49f0a52486b9915d00c9

Contents?: true

Size: 1.42 KB

Versions: 32

Compression:

Stored size: 1.42 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.

require 'new_relic/agent/instrumentation'
module NewRelic
  module Agent
    class Transaction
      module Pop
        def log_underflow
          ::NewRelic::Agent.logger.error "Underflow in transaction: #{caller.join("\n   ")}"
        end

        def record_transaction_cpu
          burn = cpu_burn
          transaction_sampler.notice_transaction_cpu_time(burn) if burn
        end

        def normal_cpu_burn
          return unless @process_cpu_start
          process_cpu - @process_cpu_start
        end

        def jruby_cpu_burn
          return unless @jruby_cpu_start
          burn = (jruby_cpu_time - @jruby_cpu_start)
          # record_jruby_cpu_burn(burn)
          burn
        end

        # we need to do this here because the normal cpu sampler
        # process doesn't work on JRuby. See the cpu_sampler.rb file
        # to understand where cpu is recorded for non-jruby processes
        def record_jruby_cpu_burn(burn)
          NewRelic::Agent.record_metric(NewRelic::Metrics::USER_TIME, burn)
        end

        def cpu_burn
          normal_cpu_burn || jruby_cpu_burn
        end

        def traced?
          NewRelic::Agent.is_execution_traced?
        end

        def current_stack_metric
          metric_name
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
newrelic_rpm-3.8.0.218 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.7.3.204 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.7.3.199 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.7.2.195 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.7.2.192 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.7.2.190.beta lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.7.1.188 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.7.1.182 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.7.1.180 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.7.0.177 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.7.0.174.beta lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.6.9.171 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.6.8.168 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.6.8.164 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.6.7.159 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.6.7.159.beta lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.6.7.152 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.6.6.147 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.6.5.130 lib/new_relic/agent/transaction/pop.rb
newrelic_rpm-3.6.4.122 lib/new_relic/agent/transaction/pop.rb