Stackdriver Trace Client - Class TraceClient (1.8.9)

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

Google Stackdriver Trace allows you to collect latency data from your applications and display it in the Google Cloud Platform Console.

Find more information at Stackdriver Trace API docs .

Example:

 use Google\Cloud\Trace\TraceClient;

$trace = new TraceClient(); 

Namespace

Google \ Cloud \ Trace

Methods

__construct

Create a Trace client.

Parameters
Name
Description
config
array

Configuration options.

↳ apiEndpoint
string

A hostname with optional port to use in place of the service's default endpoint.

↳ projectId
string

The project ID from the Google Developer's Console.

↳ authCache
CacheItemPoolInterface

A cache used storing access tokens. Defaults toa simple in memory implementation.

↳ authCacheOptions
array

Cache configuration options.

↳ authHttpHandler
callable

A handler used to deliver Psr7 requests specifically for authentication.

↳ credentialsFetcher
FetchAuthTokenInterface

A credentials fetcher instance.

↳ httpHandler
callable

A handler used to deliver Psr7 requests. Only valid for requests sent over REST.

↳ keyFile
array

The contents of the service account credentials .json file retrieved from the Google Developer's Console. Ex: json_decode(file_get_contents($path), true) .

↳ keyFilePath
string

The full path to your service account credentials .json file retrieved from the Google Developers Console.

↳ requestTimeout
float

Seconds to wait before timing out the request. Defaults to 0 with REST and 60 with gRPC.

↳ retries
int

Number of retries for a failed request. Defaults to 3 .

↳ scopes
array

Scopes to be used for the request.

↳ quotaProject
string

Specifies a user project to bill for access charges associated with the request.

insert

Parameters
Name
Description
trace
Trace

The trace log to send.

options
array

[optional] Configuration Options

Returns
Type
Description
bool

insertBatch

Parameters
Name
Description
traces
array< Trace >

The trace logs to send.

options
array

[optional] Configuration Options

Returns
Type
Description
bool

trace

Lazily find or instantiates a trace. There are no network requests made at this point. To see the operations that can be performed on a trace please see Trace . If no traceId is provided, one will be generated for you.

Example:

 // Create a trace with a generated traceId
$trace = $traceClient->trace(); 
 // Create a trace with a specific traceId
$trace = $traceClient->trace('1234abcd'); 
Parameter
Name
Description
traceId
string

[optional] The trace id of the trace to reference.

Returns
Type
Description

Constants

VERSION

  Value: '1.8.9' 
 

FULL_CONTROL_SCOPE

  Value: 'https://www.googleapis.com/auth/cloud-platform' 
 
Create a Mobile Website
View Site in Mobile | Classic
Share by: