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.
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();
string
info
Returns a serializable array representing this trace.
array
spans
Retrieves the spans for this trace.
Example:
$spans = $trace->spans();
span
Create an instance of Google\Cloud\Trace\Span
Example:
$span = $trace->span(['name' => 'newSpan']);
options
array
[optional] See {@see \Google\Cloud\Trace\Google\Cloud\Trace\Span::__construct()} for configuration details.
setSpans
Set the spans for this trace.
Example:
$trace->setSpans([$span1, $span2]);