public abstract class TraceServiceClient
Reference documentation and code samples for the Google Cloud Trace v1 API class TraceServiceClient.
TraceService client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Trace.V1Assembly
Google.Cloud.Trace.V1.dll
Remarks
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.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the TraceService service, which is a host of "cloudtrace.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
String |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default TraceService scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyList<String> |
The default TraceService scopes are:
GrpcClient
public virtual TraceService.TraceServiceClient GrpcClient { get; }
The underlying gRPC TraceService client
Property Value | |
---|---|
Type | Description |
TraceService.TraceServiceClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
Create()
public static TraceServiceClient Create()
Synchronously creates a TraceServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use TraceServiceClientBuilder.
Returns | |
---|---|
Type | Description |
TraceServiceClient | The created TraceServiceClient. |
CreateAsync(CancellationToken)
public static Task<TraceServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a TraceServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use TraceServiceClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
Task<TraceServiceClient> | The task representing the created TraceServiceClient. |
GetTrace(GetTraceRequest, CallSettings)
public virtual Trace GetTrace(GetTraceRequest request, CallSettings callSettings = null)
Gets a single trace by its ID.
Parameters | |
---|---|
Name | Description |
request | GetTraceRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Trace | The RPC response. |
// Create client
TraceServiceClient traceServiceClient = TraceServiceClient.Create();
// Initialize request argument(s)
GetTraceRequest request = new GetTraceRequest
{
ProjectId = "",
TraceId = "",
};
// Make the request
Trace response = traceServiceClient.GetTrace(request);
GetTrace(String, String, CallSettings)
public virtual Trace GetTrace(string projectId, string traceId, CallSettings callSettings = null)
Gets a single trace by its ID.
Parameters | |
---|---|
Name | Description |
projectId | String Required. ID of the Cloud project where the trace data is stored. |
traceId | String Required. ID of the trace to return. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Trace | The RPC response. |
// Create client
TraceServiceClient traceServiceClient = TraceServiceClient.Create();
// Initialize request argument(s)
string projectId = "";
string traceId = "";
// Make the request
Trace response = traceServiceClient.GetTrace(projectId, traceId);
GetTraceAsync(GetTraceRequest, CallSettings)
public virtual Task<Trace> GetTraceAsync(GetTraceRequest request, CallSettings callSettings = null)
Gets a single trace by its ID.
Parameters | |
---|---|
Name | Description |
request | GetTraceRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Trace> | A Task containing the RPC response. |
// Create client
TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();
// Initialize request argument(s)
GetTraceRequest request = new GetTraceRequest
{
ProjectId = "",
TraceId = "",
};
// Make the request
Trace response = await traceServiceClient.GetTraceAsync(request);
GetTraceAsync(GetTraceRequest, CancellationToken)
public virtual Task<Trace> GetTraceAsync(GetTraceRequest request, CancellationToken cancellationToken)
Gets a single trace by its ID.
Parameters | |
---|---|
Name | Description |
request | GetTraceRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Trace> | A Task containing the RPC response. |
// Create client
TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();
// Initialize request argument(s)
GetTraceRequest request = new GetTraceRequest
{
ProjectId = "",
TraceId = "",
};
// Make the request
Trace response = await traceServiceClient.GetTraceAsync(request);
GetTraceAsync(String, String, CallSettings)
public virtual Task<Trace> GetTraceAsync(string projectId, string traceId, CallSettings callSettings = null)
Gets a single trace by its ID.
Parameters | |
---|---|
Name | Description |
projectId | String Required. ID of the Cloud project where the trace data is stored. |
traceId | String Required. ID of the trace to return. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task<Trace> | A Task containing the RPC response. |
// Create client
TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
string traceId = "";
// Make the request
Trace response = await traceServiceClient.GetTraceAsync(projectId, traceId);
GetTraceAsync(String, String, CancellationToken)
public virtual Task<Trace> GetTraceAsync(string projectId, string traceId, CancellationToken cancellationToken)
Gets a single trace by its ID.
Parameters | |
---|---|
Name | Description |
projectId | String Required. ID of the Cloud project where the trace data is stored. |
traceId | String Required. ID of the trace to return. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Trace> | A Task containing the RPC response. |
// Create client
TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
string traceId = "";
// Make the request
Trace response = await traceServiceClient.GetTraceAsync(projectId, traceId);
ListTraces(ListTracesRequest, CallSettings)
public virtual PagedEnumerable<ListTracesResponse, Trace> ListTraces(ListTracesRequest request, CallSettings callSettings = null)
Returns of a list of traces that match the specified filter conditions.
Parameters | |
---|---|
Name | Description |
request | ListTracesRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTracesResponse, Trace> | A pageable sequence of Trace resources. |
// Create client
TraceServiceClient traceServiceClient = TraceServiceClient.Create();
// Initialize request argument(s)
ListTracesRequest request = new ListTracesRequest
{
ProjectId = "",
View = ListTracesRequest.Types.ViewType.Unspecified,
StartTime = new Timestamp(),
EndTime = new Timestamp(),
Filter = "",
OrderBy = "",
};
// Make the request
PagedEnumerable<ListTracesResponse, Trace> response = traceServiceClient.ListTraces(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Trace item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListTracesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Trace item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Trace> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Trace item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTraces(String, String, Nullable<Int32>, CallSettings)
public virtual PagedEnumerable<ListTracesResponse, Trace> ListTraces(string projectId, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Returns of a list of traces that match the specified filter conditions.
Parameters | |
---|---|
Name | Description |
projectId | String Required. ID of the Cloud project where the trace data is stored. |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerable<ListTracesResponse, Trace> | A pageable sequence of Trace resources. |
TraceServiceClient client = TraceServiceClient.Create();
PagedEnumerable<ListTracesResponse, Trace> traces = client.ListTraces(projectId);
foreach (Trace trace in traces.Take(10))
{
Console.WriteLine($"{trace.TraceId}:");
foreach (TraceSpan span in trace.Spans)
{
Console.WriteLine($" {span.StartTime}-{span.EndTime}: {span.Kind}");
}
}
ListTracesAsync(ListTracesRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListTracesResponse, Trace> ListTracesAsync(ListTracesRequest request, CallSettings callSettings = null)
Returns of a list of traces that match the specified filter conditions.
Parameters | |
---|---|
Name | Description |
request | ListTracesRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTracesResponse, Trace> | A pageable asynchronous sequence of Trace resources. |
// Create client
TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();
// Initialize request argument(s)
ListTracesRequest request = new ListTracesRequest
{
ProjectId = "",
View = ListTracesRequest.Types.ViewType.Unspecified,
StartTime = new Timestamp(),
EndTime = new Timestamp(),
Filter = "",
OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListTracesResponse, Trace> response = traceServiceClient.ListTracesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Trace item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTracesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Trace item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Trace> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Trace item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListTracesAsync(String, String, Nullable<Int32>, CallSettings)
public virtual PagedAsyncEnumerable<ListTracesResponse, Trace> ListTracesAsync(string projectId, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Returns of a list of traces that match the specified filter conditions.
Parameters | |
---|---|
Name | Description |
projectId | String Required. ID of the Cloud project where the trace data is stored. |
pageToken | String The token returned from the previous request. A value of |
pageSize | Nullable<Int32> The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerable<ListTracesResponse, Trace> | A pageable asynchronous sequence of Trace resources. |
// Create client
TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
// Make the request
PagedAsyncEnumerable<ListTracesResponse, Trace> response = traceServiceClient.ListTracesAsync(projectId);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Trace item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListTracesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Trace item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Trace> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Trace item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
PatchTraces(PatchTracesRequest, CallSettings)
public virtual void PatchTraces(PatchTracesRequest request, CallSettings callSettings = null)
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.
Parameters | |
---|---|
Name | Description |
request | PatchTracesRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
// Create client
TraceServiceClient traceServiceClient = TraceServiceClient.Create();
// Initialize request argument(s)
PatchTracesRequest request = new PatchTracesRequest
{
ProjectId = "",
Traces = new Traces(),
};
// Make the request
traceServiceClient.PatchTraces(request);
PatchTraces(String, Traces, CallSettings)
public virtual void PatchTraces(string projectId, Traces traces, CallSettings callSettings = null)
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.
Parameters | |
---|---|
Name | Description |
projectId | String Required. ID of the Cloud project where the trace data is stored. |
traces | Traces Required. The body of the message. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
// Create client
TraceServiceClient traceServiceClient = TraceServiceClient.Create();
// Initialize request argument(s)
string projectId = "";
Traces traces = new Traces();
// Make the request
traceServiceClient.PatchTraces(projectId, traces);
PatchTracesAsync(PatchTracesRequest, CallSettings)
public virtual Task PatchTracesAsync(PatchTracesRequest request, CallSettings callSettings = null)
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.
Parameters | |
---|---|
Name | Description |
request | PatchTracesRequest The request object containing all of the parameters for the API call. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();
// Initialize request argument(s)
PatchTracesRequest request = new PatchTracesRequest
{
ProjectId = "",
Traces = new Traces(),
};
// Make the request
await traceServiceClient.PatchTracesAsync(request);
PatchTracesAsync(PatchTracesRequest, CancellationToken)
public virtual Task PatchTracesAsync(PatchTracesRequest request, CancellationToken cancellationToken)
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.
Parameters | |
---|---|
Name | Description |
request | PatchTracesRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();
// Initialize request argument(s)
PatchTracesRequest request = new PatchTracesRequest
{
ProjectId = "",
Traces = new Traces(),
};
// Make the request
await traceServiceClient.PatchTracesAsync(request);
PatchTracesAsync(String, Traces, CallSettings)
public virtual Task PatchTracesAsync(string projectId, Traces traces, CallSettings callSettings = null)
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.
Parameters | |
---|---|
Name | Description |
projectId | String Required. ID of the Cloud project where the trace data is stored. |
traces | Traces Required. The body of the message. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
Traces traces = new Traces();
// Make the request
await traceServiceClient.PatchTracesAsync(projectId, traces);
PatchTracesAsync(String, Traces, CancellationToken)
public virtual Task PatchTracesAsync(string projectId, Traces traces, CancellationToken cancellationToken)
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.
Parameters | |
---|---|
Name | Description |
projectId | String Required. ID of the Cloud project where the trace data is stored. |
traces | Traces Required. The body of the message. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task | A Task containing the RPC response. |
// Create client
TraceServiceClient traceServiceClient = await TraceServiceClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
Traces traces = new Traces();
// Make the request
await traceServiceClient.PatchTracesAsync(projectId, traces);
ShutdownDefaultChannelsAsync()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Returns | |
---|---|
Type | Description |
Task | A task representing the asynchronous shutdown operation. |
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.