Sha256: bfb47487a59e880513bd27a2b240d2764fde6c4989425f19cdcc111158bb6072

Contents?: true

Size: 847 Bytes

Versions: 15

Compression:

Stored size: 847 Bytes

Contents

# encoding: utf-8

LibraryDetection.defer do
  named :rubyprof

  depends_on do
    defined?(::RubyProf) && defined?(::OneApm::Rack::DeveloperMode) && ::OneApm::Manager.config[:developer_mode]
  end

  executes do
    ::OneApm::Manager.agent.events.subscribe(:start_transaction) do
      if ::OneApm::Rack::DeveloperMode.profiled?
        begin
          ::RubyProf.start
        rescue  => e
          OneApm::Manager.logger.debug e.message
        end
      end
    end

    ::OneApm::Manager.agent.events.subscribe(:transaction_finished) do
      if ::OneApm::Rack::DeveloperMode.profiled?
        begin
          trace = OneApm::TransactionState.tl_get.current_transaction.transaction_trace
          trace.profile = ::RubyProf.stop
        rescue  => e
          OneApm::Manager.logger.debug e.message
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
oneapm_rpm-1.4.2 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.4.1 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.4.0 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.7 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.7.rc1 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.6 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.6.rc1 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.5 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.5.rc1 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.4 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.4.rc1 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.3 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.3.rc1 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.2 lib/one_apm/inst/rubyprof.rb
oneapm_rpm-1.3.2.rc1 lib/one_apm/inst/rubyprof.rb