• EnglishEspañol日本語한국어Português
  • Log inStart now

current_trace_id (Python agent API)

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()
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.