# Google Cloud Trace v2 API - Class TraceServiceClientImpl (3.7.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [3.7.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClientImpl)
- [3.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/3.6.0/Google.Cloud.Trace.V2.TraceServiceClientImpl)
- [3.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/3.5.0/Google.Cloud.Trace.V2.TraceServiceClientImpl)
- [3.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/3.4.0/Google.Cloud.Trace.V2.TraceServiceClientImpl)
- [3.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/3.3.0/Google.Cloud.Trace.V2.TraceServiceClientImpl)
- [3.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/3.2.0/Google.Cloud.Trace.V2.TraceServiceClientImpl)
- [3.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/3.1.0/Google.Cloud.Trace.V2.TraceServiceClientImpl)
- [3.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/3.0.0/Google.Cloud.Trace.V2.TraceServiceClientImpl)
- [2.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/2.3.0/Google.Cloud.Trace.V2.TraceServiceClientImpl)
- [2.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/2.2.0/Google.Cloud.Trace.V2.TraceServiceClientImpl)

    public sealed class TraceServiceClientImpl : TraceServiceClient

Reference documentation and code samples for the Google Cloud Trace v2 API class TraceServiceClientImpl.

TraceService client wrapper implementation, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [TraceServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient) \> TraceServiceClientImpl

## Inherited Members

[TraceServiceClient.DefaultEndpoint](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_DefaultEndpoint) [TraceServiceClient.DefaultScopes](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_DefaultScopes) [TraceServiceClient.ServiceMetadata](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_ServiceMetadata) [TraceServiceClient.CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_CreateAsync_System_Threading_CancellationToken_) [TraceServiceClient.Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_Create) [TraceServiceClient.ShutdownDefaultChannelsAsync()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_ShutdownDefaultChannelsAsync) [TraceServiceClient.BatchWriteSpansAsync(BatchWriteSpansRequest, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_BatchWriteSpansAsync_Google_Cloud_Trace_V2_BatchWriteSpansRequest_System_Threading_CancellationToken_) [TraceServiceClient.BatchWriteSpans(string, IEnumerable\<Span\>, CallSettings)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_BatchWriteSpans_System_String_System_Collections_Generic_IEnumerable_Google_Cloud_Trace_V2_Span__Google_Api_Gax_Grpc_CallSettings_) [TraceServiceClient.BatchWriteSpansAsync(string, IEnumerable\<Span\>, CallSettings)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_BatchWriteSpansAsync_System_String_System_Collections_Generic_IEnumerable_Google_Cloud_Trace_V2_Span__Google_Api_Gax_Grpc_CallSettings_) [TraceServiceClient.BatchWriteSpansAsync(string, IEnumerable\<Span\>, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_BatchWriteSpansAsync_System_String_System_Collections_Generic_IEnumerable_Google_Cloud_Trace_V2_Span__System_Threading_CancellationToken_) [TraceServiceClient.BatchWriteSpans(ProjectName, IEnumerable\<Span\>, CallSettings)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_BatchWriteSpans_Google_Api_Gax_ResourceNames_ProjectName_System_Collections_Generic_IEnumerable_Google_Cloud_Trace_V2_Span__Google_Api_Gax_Grpc_CallSettings_) [TraceServiceClient.BatchWriteSpansAsync(ProjectName, IEnumerable\<Span\>, CallSettings)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_BatchWriteSpansAsync_Google_Api_Gax_ResourceNames_ProjectName_System_Collections_Generic_IEnumerable_Google_Cloud_Trace_V2_Span__Google_Api_Gax_Grpc_CallSettings_) [TraceServiceClient.BatchWriteSpansAsync(ProjectName, IEnumerable\<Span\>, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_BatchWriteSpansAsync_Google_Api_Gax_ResourceNames_ProjectName_System_Collections_Generic_IEnumerable_Google_Cloud_Trace_V2_Span__System_Threading_CancellationToken_) [TraceServiceClient.CreateSpanAsync(Span, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_CreateSpanAsync_Google_Cloud_Trace_V2_Span_System_Threading_CancellationToken_) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Trace.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2)

## Assembly

Google.Cloud.Trace.V2.dll

## Remarks

Service for collecting and viewing traces and spans within a trace.

A trace is a collection of spans corresponding to a single
operation or a set of operations in an application.

A span is an individual timed event which forms a node of the trace tree.
A single trace can contain spans from multiple services.

## Constructors

### TraceServiceClientImpl(TraceServiceClient, TraceServiceSettings, ILogger)

    public TraceServiceClientImpl(TraceService.TraceServiceClient grpcClient, TraceServiceSettings settings, ILogger logger)

Constructs a client wrapper for the TraceService service, with the specified gRPC client and settings.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `grpcClient` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServicehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceService.TraceServiceClient` The underlying gRPC client. |
| `settings` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceSettings` The base [TraceServiceSettings](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceSettings) used within this client. |
| `logger` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger` Optional [ILogger](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger) to use within this client. |

## Properties

### GrpcClient

    public override TraceService.TraceServiceClient GrpcClient { get; }

The underlying gRPC TraceService client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServicehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceService.TraceServiceClient` |   |

**Overrides** [TraceServiceClient.GrpcClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_GrpcClient)

## Methods

### BatchWriteSpans(BatchWriteSpansRequest, CallSettings)

    public override void BatchWriteSpans(BatchWriteSpansRequest request, CallSettings callSettings = null)

Batch writes new spans to new or existing traces. You cannot update
existing spans.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.BatchWriteSpansRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

**Overrides** [TraceServiceClient.BatchWriteSpans(BatchWriteSpansRequest, CallSettings)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_BatchWriteSpans_Google_Cloud_Trace_V2_BatchWriteSpansRequest_Google_Api_Gax_Grpc_CallSettings_)

### BatchWriteSpansAsync(BatchWriteSpansRequest, CallSettings)

    public override Task BatchWriteSpansAsync(BatchWriteSpansRequest request, CallSettings callSettings = null)

Batch writes new spans to new or existing traces. You cannot update
existing spans.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.BatchWriteSpansRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A Task containing the RPC response. |

**Overrides** [TraceServiceClient.BatchWriteSpansAsync(BatchWriteSpansRequest, CallSettings)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_BatchWriteSpansAsync_Google_Cloud_Trace_V2_BatchWriteSpansRequest_Google_Api_Gax_Grpc_CallSettings_)

### CreateSpan(Span, CallSettings)

    public override Span CreateSpan(Span request, CallSettings callSettings = null)

Creates a new span.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.Span` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.Span` | The RPC response. |

**Overrides** [TraceServiceClient.CreateSpan(Span, CallSettings)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_CreateSpan_Google_Cloud_Trace_V2_Span_Google_Api_Gax_Grpc_CallSettings_)

### CreateSpanAsync(Span, CallSettings)

    public override Task<Span> CreateSpanAsync(Span request, CallSettings callSettings = null)

Creates a new span.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.Span` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.Span` | A Task containing the RPC response. |

**Overrides** [TraceServiceClient.CreateSpanAsync(Span, CallSettings)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceServiceClient#Google_Cloud_Trace_V2_TraceServiceClient_CreateSpanAsync_Google_Cloud_Trace_V2_Span_Google_Api_Gax_Grpc_CallSettings_)