Stackdriver Trace Client - Class Trace (1.8.8)

Reference documentation and code samples for the Stackdriver Trace Client class Trace.

This plain PHP class represents a Trace resource. The model currently has no backing API model and is identified by its traceId.

Example:

use Google\Cloud\Trace\TraceClient;

$traceClient = new TraceClient();

$trace = $traceClient->trace();

Namespace

Google \ Cloud \ Trace

Methods

__construct

Instantiate a new Trace instance.

Parameters
Name Description
projectId string

The id of the project this trace belongs to.

traceId string

[optional] The id of the trace. If not provided, one will be generated automatically for you.

spans array

[optional] Array of Span constructor arguments. See Span::__construct() for configuration details.

traceId

Retrieves the trace's id.

Example:

echo $trace->traceId();
Returns
Type Description
string

info

Returns a serializable array representing this trace.

Returns
Type Description
array

spans

Retrieves the spans for this trace.

Example:

$spans = $trace->spans();
Returns
Type Description
array<Span>

span

Create an instance of Span

Example:

$span = $trace->span(['name' => 'newSpan']);
Parameter
Name Description
options array

[optional] See Span::__construct() for configuration details.

Returns
Type Description
Span

setSpans

Set the spans for this trace.

Example:

$trace->setSpans([$span1, $span2]);
Parameter
Name Description
spans array<Span>