newrelic_create_distributed_trace_payload

newrelic_create_distributed_trace_payload()
Creates a distributed trace payload.

Requirements

Requires PHP agent version 8.4 or higher.

Description

Distributed tracing allows you to see the path that a request takes as it travels through a distributed system. Use this API method to create a distributed trace payload.

Return value(s)

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();

Example(s)

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

For more help

Recommendations for learning more: