Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4.3.0
with:
dotnet-version: 7.0.x
dotnet-version: 9.0.x

- name: Checkout Npgsql
uses: actions/checkout@v4
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
working-directory: EFCore.PG

- name: Get docfx
run: dotnet tool install --version 2.78.0 -g docfx
run: dotnet tool install --version 2.78.3 -g docfx

- name: Build docs
run: docfx --warningsAsErrors
Expand Down
4 changes: 2 additions & 2 deletions conceptual/Npgsql/diagnostics/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ In this trace, the Npgsql query (to database testdb) took around 800ms, and was
>
> This feature was introduced in Npgsql 9.0

Once you've enabled Npgsql tracing as above, you can tweak its configuration via the <xref:Npgsql.NpgsqlDataSourceBuilder.ConfigureTracingOptions*?displayProperty=nameWithType> API:
Once you've enabled Npgsql tracing as above, you can tweak its configuration via the <xref:Npgsql.NpgsqlDataSourceBuilder.ConfigureTracing*?displayProperty=nameWithType> API:

```csharp
dataSourceBuilder.ConfigureTracing(o => o
Expand All @@ -56,7 +56,7 @@ This allows you to:

## Using `AsyncLocal` to pass arbitrary information to your callbacks

The callbacks available via <xref:Npgsql.NpgsqlDataSourceBuilder.ConfigureTracingOptions*?displayProperty=nameWithType> only accept the <xref:Npgsql.NpgsqlCommand> or <xref:Npgsql.NpgsqlBatch> as their parameters; this makes it difficult to e.g. assign arbitrary names to your commands, so that show up as the span names in your tracing monitor. You can use .NET [`AsyncLocal`](https://learn.microsoft.com/dotnet/api/system.threading.asynclocal-1) to flow arbitrary information from the command call site (where you execute the command) to your tracing callbacks to achieve this.
The callbacks available via <xref:Npgsql.NpgsqlDataSourceBuilder.ConfigureTracing*?displayProperty=nameWithType> only accept the <xref:Npgsql.NpgsqlCommand> or <xref:Npgsql.NpgsqlBatch> as their parameters; this makes it difficult to e.g. assign arbitrary names to your commands, so that show up as the span names in your tracing monitor. You can use .NET [`AsyncLocal`](https://learn.microsoft.com/dotnet/api/system.threading.asynclocal-1) to flow arbitrary information from the command call site (where you execute the command) to your tracing callbacks to achieve this.

For example, the following adds an `ExecuteReaderWithSpanNameAsync` extension method to <xref:Npgsql.NpgsqlCommand>:

Expand Down
2 changes: 1 addition & 1 deletion conceptual/Npgsql/release-notes/9.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Npgsql.EntityFrameworkCore.PostgreSQL version 9.0 is out and available on [nuget

## Tracing improvements

Several quality-of-life improvements have been implemented for Npgsql's OpenTelemetry tracing support. You can now do the following via the new <xref:Npgsql.NpgsqlDataSourceBuilder.ConfigureTracingOptions*?displayProperty=nameWithType> API:
Several quality-of-life improvements have been implemented for Npgsql's OpenTelemetry tracing support. You can now do the following via the new <xref:Npgsql.NpgsqlDataSourceBuilder.ConfigureTracing*?displayProperty=nameWithType> API:

* Specify a filter which determines which commands get traced
* Set the the tracing span name (e.g. use the command's SQL as the span name)
Expand Down