newrelic_insert_distributed_trace_headers (array $headers)
Inserts W3C Trace Context headers and New Relic Distributed Tracing headers into an outbound array of headers.


Requires PHP agent version 9.8 or higher.


Use newrelic_insert_distributed_trace_headers to manually add distributed tracing headers an array of outbound headers.

When Distributed Tracing is enabled, newrelic_insert_distributed_trace_headers will always insert W3C trace context headers. It also, by default, inserts the New Relic Distributed Tracing header, but this can be disabled via the newrelic.distributed_tracing_exclude_newrelic_header INI setting.


Parameter Description



Required. An (optionally empty) array of outbound headers. This argument is passed by reference, and therefore must be a variable as opposed to a literal.

Return value(s)

True if any headers were successfully inserted into the provided array, otherwise returns False


For examples of how and when to use this API method, see the documentation to manually instrument applications and services.

For more help

If you need more help, check out these support and learning resources: