3.7.0 (latest) 3.6.0 3.5.0 3.4.0 3.3.0 3.2.0 3.1.0 3.0.0 2.3.0 2.2.0

    public class TraceService.TraceServiceClient : ClientBase<TraceService.TraceServiceClient>

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

Client for TraceService

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [ClientBase](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase.md.txt) \> [ClientBase](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase-1.md.txt)[TraceService](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceService.md.txt)[TraceServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Trace.V2/latest/Google.Cloud.Trace.V2.TraceService.TraceServiceClient.md.txt) \> TraceService.TraceServiceClient

## Inherited Members

[ClientBase\<TraceService.TraceServiceClient\>.WithHost(string)](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase-1.md.txt#Grpc_Core_ClientBase_1_WithHost_System_String_) [ClientBase.CallInvoker](https://docs.cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase.md.txt#Grpc_Core_ClientBase_CallInvoker) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [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.md.txt)

## Assembly

Google.Cloud.Trace.V2.dll

## Constructors

### TraceServiceClient()

    protected TraceServiceClient()

Protected parameterless constructor to allow creation of test doubles.

### TraceServiceClient(CallInvoker)

    public TraceServiceClient(CallInvoker callInvoker)

Creates a new client for TraceService that uses a custom `CallInvoker`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `callInvoker` | `CallInvoker` The callInvoker to use to make remote calls. |

### TraceServiceClient(ChannelBase)

    public TraceServiceClient(ChannelBase channel)

Creates a new client for TraceService

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `channel` | `ChannelBase` The channel to use to make remote calls. |

### TraceServiceClient(ClientBaseConfiguration)

    protected TraceServiceClient(ClientBase.ClientBaseConfiguration configuration)

Protected constructor to allow creation of configured clients.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `configuration` | `ClientBaseClientBaseConfiguration` The client configuration. |

## Methods

### BatchWriteSpans(BatchWriteSpansRequest, CallOptions)

    public virtual Empty BatchWriteSpans(BatchWriteSpansRequest request, CallOptions options)

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `BatchWriteSpansRequest` The request to send to the server. |
| `options` | `CallOptions` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Empty` | The response received from the server. |

### BatchWriteSpans(BatchWriteSpansRequest, Metadata, DateTime?, CancellationToken)

    public virtual Empty BatchWriteSpans(BatchWriteSpansRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `BatchWriteSpansRequest` The request to send to the server. |
| `headers` | `Metadata` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `CancellationToken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Empty` | The response received from the server. |

### BatchWriteSpansAsync(BatchWriteSpansRequest, CallOptions)

    public virtual AsyncUnaryCall<Empty> BatchWriteSpansAsync(BatchWriteSpansRequest request, CallOptions options)

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `BatchWriteSpansRequest` The request to send to the server. |
| `options` | `CallOptions` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `AsyncUnaryCallEmpty` | The call object. |

### BatchWriteSpansAsync(BatchWriteSpansRequest, Metadata, DateTime?, CancellationToken)

    public virtual AsyncUnaryCall<Empty> BatchWriteSpansAsync(BatchWriteSpansRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `BatchWriteSpansRequest` The request to send to the server. |
| `headers` | `Metadata` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `CancellationToken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `AsyncUnaryCallEmpty` | The call object. |

### CreateSpan(Span, CallOptions)

    public virtual Span CreateSpan(Span request, CallOptions options)

Creates a new span.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Span` The request to send to the server. |
| `options` | `CallOptions` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Span` | The response received from the server. |

### CreateSpan(Span, Metadata, DateTime?, CancellationToken)

    public virtual Span CreateSpan(Span request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Creates a new span.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Span` The request to send to the server. |
| `headers` | `Metadata` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `CancellationToken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Span` | The response received from the server. |

### CreateSpanAsync(Span, CallOptions)

    public virtual AsyncUnaryCall<Span> CreateSpanAsync(Span request, CallOptions options)

Creates a new span.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Span` The request to send to the server. |
| `options` | `CallOptions` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `AsyncUnaryCallSpan` | The call object. |

### CreateSpanAsync(Span, Metadata, DateTime?, CancellationToken)

    public virtual AsyncUnaryCall<Span> CreateSpanAsync(Span request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Creates a new span.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `Span` The request to send to the server. |
| `headers` | `Metadata` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `CancellationToken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `AsyncUnaryCallSpan` | The call object. |

### NewInstance(ClientBaseConfiguration)

    protected override TraceService.TraceServiceClient NewInstance(ClientBase.ClientBaseConfiguration configuration)

Creates a new instance of client from given `ClientBaseConfiguration`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `configuration` | `ClientBaseClientBaseConfiguration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TraceServiceTraceServiceClient` |   |

**Overrides** Grpc.Core.ClientBase\<Google.Cloud.Trace.V2.TraceService.TraceServiceClient\>.NewInstance(Grpc.Core.ClientBase.ClientBaseConfiguration)