• Log in

newrelic_create_distributed_trace_payload (PHP agent API)



Creates a distributed trace payload.


Requires PHP agent version 8.4 or higher.


Distributed tracing allows you to see the path that a request takes as it travels through a distributed system.


With PHP agent version 9.10 or higher, the following JSON functions are now considered deprecated and will be removed in a future release:


Instead, use the API that is compatible with W3C Trace Context support, added in agent version 9.8. With this, the API for manually instrumenting applications has changed from the JSON payload related functions to the following header array forms:


Return values

This method returns an object of type newrelic\DistributedTracePayload.This object has two methods that will render a distributed trace payload as text.

$payload = newrelic_create_distributed_trace_payload();// renders the payload as a JSON string$jsonText = $payload->text();// renders the payload as an string suitable for transport via HTTP (query string, POST param, HTTP headers, etc.)$httpSafeString = $payload->httpSafe();


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

Copyright © 2022 New Relic Inc.

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