From d63054518775ca816d81ce87d88c8cfc64673b9b Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 9 Jul 2026 13:25:25 +1200 Subject: [PATCH 1/3] docs(dotnet): document PreferTransactionNameProvider option Adds the ASP.NET Core `TransactionNameProvider` and new `PreferTransactionNameProvider` options to the .NET configuration options page. Ref getsentry/sentry-dotnet#5349 Co-Authored-By: Claude Opus 4.8 --- .../dotnet/common/configuration/options.mdx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/platforms/dotnet/common/configuration/options.mdx b/docs/platforms/dotnet/common/configuration/options.mdx index bc41dfdaf5065..b03a29a2876d4 100644 --- a/docs/platforms/dotnet/common/configuration/options.mdx +++ b/docs/platforms/dotnet/common/configuration/options.mdx @@ -206,6 +206,30 @@ This parameter controls whether integrations should capture HTTP request bodies. + + + + +A callback used to name transactions for requests that the routing system doesn't resolve to a route template (for example, requests that don't match any endpoint). It receives the current `HttpContext` and returns the transaction name to use, or `null`/`string.Empty` to fall back to the URL path. + +```csharp +options.TransactionNameProvider = context => context.Request.Path; +``` + +By default the provider is only invoked as a fallback for unresolved routes. To have it run on every request, enable . + + + + + +Controls when is invoked. + +When `false` (the default), the provider only runs as a fallback for requests whose route can't be resolved to a template, preserving the legacy behavior. When `true`, the provider runs on every request after routing, and a non-empty return value overrides the route-derived transaction name. If the provider returns `null` or `string.Empty`, the routed name is kept (or the URL-path fallback applies when no route was resolved). + + + + + From 8831fa639ed8b44c5405d9fdf1f9ac27baf4ebe6 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Fri, 10 Jul 2026 11:44:52 +1200 Subject: [PATCH 2/3] Update docs/platforms/dotnet/common/configuration/options.mdx --- docs/platforms/dotnet/common/configuration/options.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/dotnet/common/configuration/options.mdx b/docs/platforms/dotnet/common/configuration/options.mdx index b03a29a2876d4..9c129fb9a5f0a 100644 --- a/docs/platforms/dotnet/common/configuration/options.mdx +++ b/docs/platforms/dotnet/common/configuration/options.mdx @@ -224,7 +224,7 @@ By default the provider is only invoked as a fallback for unresolved routes. To Controls when is invoked. -When `false` (the default), the provider only runs as a fallback for requests whose route can't be resolved to a template, preserving the legacy behavior. When `true`, the provider runs on every request after routing, and a non-empty return value overrides the route-derived transaction name. If the provider returns `null` or `string.Empty`, the routed name is kept (or the URL-path fallback applies when no route was resolved). +When `false` (the default), the provider only runs as a fallback for requests whose route can't be resolved to a template. When `true`, the provider runs on every request after routing, and a non-empty return value overrides the route-derived transaction name. If the provider returns `null` or `string.Empty`, the routed name is kept (or the URL-path fallback applies when no route was resolved). From 4829771dd763f5834d4c7c2a275196e4a732917d Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Fri, 10 Jul 2026 11:50:34 +1200 Subject: [PATCH 3/3] docs(dotnet): clarify HTTP method is prepended to custom transaction name Addresses review feedback: the TransactionNameProvider callback returns only the route portion; Sentry prepends the uppercased HTTP method. Co-Authored-By: Claude Opus 4.8 --- docs/platforms/dotnet/common/configuration/options.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/dotnet/common/configuration/options.mdx b/docs/platforms/dotnet/common/configuration/options.mdx index b03a29a2876d4..b4fcd8589c77a 100644 --- a/docs/platforms/dotnet/common/configuration/options.mdx +++ b/docs/platforms/dotnet/common/configuration/options.mdx @@ -210,7 +210,7 @@ This parameter controls whether integrations should capture HTTP request bodies. -A callback used to name transactions for requests that the routing system doesn't resolve to a route template (for example, requests that don't match any endpoint). It receives the current `HttpContext` and returns the transaction name to use, or `null`/`string.Empty` to fall back to the URL path. +A callback used to name transactions for requests that the routing system doesn't resolve to a route template (for example, requests that don't match any endpoint). It receives the current `HttpContext` and returns the route portion of the name; Sentry prepends the uppercased HTTP method, so returning `orders/list` produces a transaction named `GET orders/list`. Return `null` or `string.Empty` to fall back to the URL path. ```csharp options.TransactionNameProvider = context => context.Request.Path;