# Class NpgsqlTracingOptionsBuilder

Namespace
  Npgsql

Assembly
  Npgsql.dll

A builder to configure Npgsql's support for OpenTelemetry tracing.

    public sealed class NpgsqlTracingOptionsBuilder

Inheritance
  object
  NpgsqlTracingOptionsBuilder

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.ReferenceEquals(object, object)
  object.ToString()

## Methods

### ConfigureBatchEnrichmentCallback(Action<Activity, NpgsqlBatch>?)

Configures a callback that can enrich the Activity emitted for the given NpgsqlBatch.

    public NpgsqlTracingOptionsBuilder ConfigureBatchEnrichmentCallback(Action<Activity, NpgsqlBatch>? batchEnrichmentCallback)

#### Parameters

`batchEnrichmentCallback` Action<Activity, NpgsqlBatch>

#### Returns

NpgsqlTracingOptionsBuilder

### ConfigureBatchFilter(Func<NpgsqlBatch, bool>?)

Configures a filter function that determines whether to emit tracing information for an NpgsqlBatch. By default, tracing information is emitted for all batches.

    public NpgsqlTracingOptionsBuilder ConfigureBatchFilter(Func<NpgsqlBatch, bool>? batchFilter)

#### Parameters

`batchFilter` Func<NpgsqlBatch, bool>

#### Returns

NpgsqlTracingOptionsBuilder

### ConfigureBatchSpanNameProvider(Func<NpgsqlBatch, string?>?)

Configures a callback that provides the tracing span's name for an NpgsqlBatch. If `null`, the default standard span name is used, which is the database name.

    public NpgsqlTracingOptionsBuilder ConfigureBatchSpanNameProvider(Func<NpgsqlBatch, string?>? batchSpanNameProvider)

#### Parameters

`batchSpanNameProvider` Func<NpgsqlBatch, string>

#### Returns

NpgsqlTracingOptionsBuilder

### ConfigureCommandEnrichmentCallback(Action<Activity, NpgsqlCommand>?)

Configures a callback that can enrich the Activity emitted for the given NpgsqlCommand.

    public NpgsqlTracingOptionsBuilder ConfigureCommandEnrichmentCallback(Action<Activity, NpgsqlCommand>? commandEnrichmentCallback)

#### Parameters

`commandEnrichmentCallback` Action<Activity, NpgsqlCommand>

#### Returns

NpgsqlTracingOptionsBuilder

### ConfigureCommandFilter(Func<NpgsqlCommand, bool>?)

Configures a filter function that determines whether to emit tracing information for an NpgsqlCommand. By default, tracing information is emitted for all commands.

    public NpgsqlTracingOptionsBuilder ConfigureCommandFilter(Func<NpgsqlCommand, bool>? commandFilter)

#### Parameters

`commandFilter` Func<NpgsqlCommand, bool>

#### Returns

NpgsqlTracingOptionsBuilder

### ConfigureCommandSpanNameProvider(Func<NpgsqlCommand, string?>?)

Configures a callback that provides the tracing span's name for an NpgsqlCommand. If `null`, the default standard span name is used, which is the database name.

    public NpgsqlTracingOptionsBuilder ConfigureCommandSpanNameProvider(Func<NpgsqlCommand, string?>? commandSpanNameProvider)

#### Parameters

`commandSpanNameProvider` Func<NpgsqlCommand, string>

#### Returns

NpgsqlTracingOptionsBuilder

### ConfigureCopyOperationEnrichmentCallback(Action<Activity, string>?)

Configures a callback that can enrich the Activity emitted for a given copy operation.

    public NpgsqlTracingOptionsBuilder ConfigureCopyOperationEnrichmentCallback(Action<Activity, string>? copyOperationEnrichmentCallback)

#### Parameters

`copyOperationEnrichmentCallback` Action<Activity, string>

#### Returns

NpgsqlTracingOptionsBuilder

### ConfigureCopyOperationFilter(Func<string, bool>?)

Configures a filter function that determines whether to emit tracing information for a copy operation. By default, tracing information is emitted for all copy operations.

    public NpgsqlTracingOptionsBuilder ConfigureCopyOperationFilter(Func<string, bool>? copyOperationFilter)

#### Parameters

`copyOperationFilter` Func<string, bool>

#### Returns

NpgsqlTracingOptionsBuilder

### ConfigureCopyOperationSpanNameProvider(Func<string, string?>?)

Configures a callback that provides the tracing span's name for a copy operation. If `null`, the default standard span name is used, which is the database name.

    public NpgsqlTracingOptionsBuilder ConfigureCopyOperationSpanNameProvider(Func<string, string?>? copyOperationSpanNameProvider)

#### Parameters

`copyOperationSpanNameProvider` Func<string, string>

#### Returns

NpgsqlTracingOptionsBuilder

### EnableFirstResponseEvent(bool)

Gets or sets a value indicating whether to enable the "time-to-first-read" event. Default is true to preserve existing behavior.

    public NpgsqlTracingOptionsBuilder EnableFirstResponseEvent(bool enable = true)

#### Parameters

`enable` bool

#### Returns

NpgsqlTracingOptionsBuilder

### EnablePhysicalOpenTracing(bool)

Gets or sets a value indicating whether to trace physical connection open. Default is true to preserve existing behavior.

    public NpgsqlTracingOptionsBuilder EnablePhysicalOpenTracing(bool enable = true)

#### Parameters

`enable` bool

#### Returns

NpgsqlTracingOptionsBuilder