Sha256: 517948630e4f144288b3af24c8d6786fd102032727ad760ca034018f15444356

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

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

DependencyDetection.defer do
  named :rubyprof

  depends_on do
    defined?(::RubyProf)
  end

  executes do
    NewRelic::Agent.instance.events.subscribe(:start_transaction) do
      if NewRelic::Agent.config[:'profiling.enabled']
        ::RubyProf.start
      end
    end

    NewRelic::Agent.instance.events.subscribe(:transaction_finished) do
      if NewRelic::Agent.config[:'profiling.enabled']
        trace = NewRelic::Agent::TransactionState.get.most_recent_transaction.transaction_trace
        trace.profile = ::RubyProf.stop
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
newrelic_rpm-3.8.1.221 lib/new_relic/agent/instrumentation/rubyprof.rb