TraceServiceClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
This file describes an API for collecting and viewing traces and spans within a trace. A Trace is a collection of spans corresponding to a single operation or set of operations for an application. A span is an individual timed event which forms a node of the trace tree. Spans for a single trace may span multiple services.
Methods
TraceServiceClient
TraceServiceClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Constructor.
Name | Description |
channel |
grpc.Channel
DEPRECATED. A |
credentials |
google.auth.credentials.Credentials
The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to |
client_config |
dict
DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used. |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
client_options |
Union[dict, google.api_core.client_options.ClientOptions]
Client options used to set user options on the client. API Endpoint should be set through client_options. |
from_service_account_file
from_service_account_file(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Name | Description |
filename |
str
The path to the service account private key json file. |
Type | Description |
TraceServiceClient | The constructed client. |
from_service_account_json
from_service_account_json(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Name | Description |
filename |
str
The path to the service account private key json file. |
Type | Description |
TraceServiceClient | The constructed client. |
get_trace
get_trace(project_id, trace_id, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Gets a single trace by its ID.
.. rubric:: Example
from google.cloud import trace_v1
client = trace_v1.TraceServiceClient()
TODO: Initialize
project_id
:project_id = ''
TODO: Initialize
trace_id
:trace_id = ''
response = client.get_trace(project_id, trace_id)
Name | Description |
project_id |
str
Required. ID of the Cloud project where the trace data is stored. |
trace_id |
str
Required. ID of the trace to return. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
list_traces
list_traces(project_id, view=None, page_size=None, start_time=None, end_time=None, filter_=None, order_by=None, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Returns of a list of traces that match the specified filter conditions.
.. rubric:: Example
from google.cloud import trace_v1
client = trace_v1.TraceServiceClient()
TODO: Initialize
project_id
:project_id = ''
Iterate over all results
for element in client.list_traces(project_id): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_traces(project_id).pages: ... for element in page: ... # process element ... pass
Name | Description |
project_id |
str
Required. ID of the Cloud project where the trace data is stored. |
view |
ViewType
Optional. Type of data returned for traces in the list. Default is |
page_size |
int
The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. |
start_time |
Union[dict, Timestamp]
Start of the time interval (inclusive) during which the trace data was collected from the application. If a dict is provided, it must be of the same form as the protobuf message Timestamp |
end_time |
Union[dict, Timestamp]
End of the time interval (inclusive) during which the trace data was collected from the application. If a dict is provided, it must be of the same form as the protobuf message Timestamp |
filter_ |
str
Optional. A filter against labels for the request. By default, searches use prefix matching. To specify exact match, prepend a plus symbol ( |
order_by |
str
Optional. Field used to sort the returned traces. Can be one of the following: - |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |
patch_traces
patch_traces(project_id, traces, retry=<_MethodDefault._DEFAULT_VALUE: <object object>>, timeout=<_MethodDefault._DEFAULT_VALUE: <object object>>, metadata=None)
Sends new traces to Stackdriver Trace or updates existing traces. If the ID of a trace that you send matches that of an existing trace, any fields in the existing trace and its spans are overwritten by the provided values, and any new fields provided are merged with the existing trace data. If the ID does not match, a new trace is created.
.. rubric:: Example
from google.cloud import trace_v1
client = trace_v1.TraceServiceClient()
TODO: Initialize
project_id
:project_id = ''
TODO: Initialize
traces
:traces = {}
client.patch_traces(project_id, traces)
Name | Description |
project_id |
str
Required. ID of the Cloud project where the trace data is stored. |
traces |
Union[dict, Traces]
Required. The body of the message. If a dict is provided, it must be of the same form as the protobuf message Traces |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
google.api_core.exceptions.GoogleAPICallError | If the request failed for any reason. |
google.api_core.exceptions.RetryError | If the request failed due to a retryable error and retry attempts failed. |
ValueError | If the parameters are invalid. |