module NewRelic::Agent::Instrumentation::Rake::Tracer

Constants

INSTRUMENTATION_NAME

Public Instance Methods

invoke_with_newrelic_tracing(*args) { || ... } click to toggle source
# File lib/new_relic/agent/instrumentation/rake/instrumentation.rb, line 12
def invoke_with_newrelic_tracing(*args)
  unless NewRelic::Agent::Instrumentation::Rake.should_trace?(name)
    return yield
  end

  NewRelic::Agent.record_instrumentation_invocation(INSTRUMENTATION_NAME)

  begin
    timeout = NewRelic::Agent.config[:'rake.connect_timeout']
    NewRelic::Agent.instance.wait_on_connect(timeout)
  rescue => e
    NewRelic::Agent.logger.error('Exception in wait_on_connect', e)
    return yield
  end

  NewRelic::Agent::Instrumentation::Rake.before_invoke_transaction(self)

  NewRelic::Agent::Tracer.in_transaction(name: "OtherTransaction/Rake/invoke/#{name}", category: :rake) do
    NewRelic::Agent::Instrumentation::Rake.record_attributes(args, self)
    yield
  end
end