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 \ TraceMethods
__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 to a 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. |
↳ keyFile |
array
[DEPRECATED] @deprecated This option is being deprecated because of a potential security risk. This option does not validate the credential configuration. The security risk occurs when a credential configuration is accepted from a source that is not under your control and used without validation on your side. If you know that you will be loading credential configurations of a specific type, it is recommended to create the credentials directly and configure them using the |
↳ keyFilePath |
string
[DEPRECATED] @deprecated This option is being deprecated because of a potential security risk. This option does not validate the credential configuration. The security risk occurs when a credential configuration is accepted from a source that is not under your control and used without validation on your side. If you know that you will be loading credential configurations of a specific type, it is recommended to create the credentials directly and configure them using the |
↳ requestTimeout |
float
Seconds to wait before timing out the request. Defaults to |
↳ retries |
int
Number of retries for a failed request. Defaults to |
↳ 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
See also:
Parameters | |
---|---|
Name | Description |
trace |
Trace
The trace log to send. |
options |
array
[optional] Configuration Options |
Returns | |
---|---|
Type | Description |
bool |
insertBatch
See also:
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 |
Trace |
Constants
VERSION
Value: '1.9.1'
FULL_CONTROL_SCOPE
Value: 'https://www.googleapis.com/auth/cloud-platform'