Syntax
newrelic.agent.current_trace_id()Returns the trace ID of the current transaction or None if no transaction exists.
Description
Use current_trace_id to retrieve the trace ID of the current transaction.
Return values
Returns the trace ID of the current transaction. Returns None if there is no active transaction.
Examples
Get the current trace ID
import newrelic.agent
@newrelic.agent.background_task() def main(): trace_id = newrelic.agent.current_trace_id()