Stackdriver Trace Client - Class Trace (1.5.3)

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

Methods

__construct

Instantiate a new Trace instance.

Parameters
NameDescription
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 {@see \Google\Cloud\Trace\Google\Cloud\Trace\Span::__construct()} for configuration details.

traceId

Retrieves the trace's id.

Example:

echo $trace->traceId();
Returns
TypeDescription
string

info

Returns a serializable array representing this trace.

Returns
TypeDescription
array

spans

Retrieves the spans for this trace.

Example:

$spans = $trace->spans();
Returns
TypeDescription
array<Google\Cloud\Trace\Span>

span

Create an instance of Google\Cloud\Trace\Span

Example:

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

[optional] See {@see \Google\Cloud\Trace\Google\Cloud\Trace\Span::__construct()} for configuration details.

Returns
TypeDescription
Google\Cloud\Trace\Span

setSpans

Set the spans for this trace.

Example:

$trace->setSpans([$span1, $span2]);
Parameter
NameDescription
spans array<Google\Cloud\Trace\Span>