Sha256: b1d9cc0785f783b6c9c6a748cc4396a20069de00c543761e4faebbd9204d0fad

Contents?: true

Size: 802 Bytes

Versions: 35

Compression:

Stored size: 802 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) && defined?(::NewRelic::Rack::DeveloperMode) && ::NewRelic::Agent.config[:developer_mode]
  end

  executes do
    NewRelic::Agent.instance.events.subscribe(:start_transaction) do
      if NewRelic::Rack::DeveloperMode.profiling_enabled?
        ::RubyProf.start
      end
    end

    NewRelic::Agent.instance.events.subscribe(:transaction_finished) do
      if NewRelic::Rack::DeveloperMode.profiling_enabled?
        trace = NewRelic::Agent::Transaction.tl_current.transaction_trace
        trace.profile = ::RubyProf.stop
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
newrelic_rpm-3.13.0.299 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.12.1.298 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.12.0.288 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.11.2.286 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.11.1.284 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.11.0.283 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.10.0.279 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.9.9.275 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.9.8.273 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.9.7.266 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.9.6.257 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.9.5.251 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.9.4.245 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.9.3.241 lib/new_relic/agent/instrumentation/rubyprof.rb
newrelic_rpm-3.9.2.239 lib/new_relic/agent/instrumentation/rubyprof.rb