Skip to content

feat: Add PreferTransactionNameProvider option#5159

Merged
jamescrosswell merged 8 commits into
mainfrom
tnp-5123
Jul 6, 2026
Merged

feat: Add PreferTransactionNameProvider option#5159
jamescrosswell merged 8 commits into
mainfrom
tnp-5123

Conversation

@jamescrosswell

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Apr 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.14%. Comparing base (0ca07a7) to head (e9089eb).
⚠️ Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5159      +/-   ##
==========================================
- Coverage   74.20%   74.14%   -0.06%     
==========================================
  Files         501      508       +7     
  Lines       18113    18287     +174     
  Branches     3521     3577      +56     
==========================================
+ Hits        13440    13559     +119     
- Misses       3811     3859      +48     
- Partials      862      869       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread AGENTS.md
@jamescrosswell
jamescrosswell marked this pull request as ready for review April 23, 2026 08:09
Comment thread src/Sentry.AspNetCore/SentryTracingMiddleware.cs Outdated
Comment thread src/Sentry.AspNetCore/SentryAspNetCoreOptions.cs Outdated
Comment thread src/Sentry.AspNetCore/SentryTracingMiddleware.cs Outdated
Submodule modules/sentry-cocoa was not changed in this PR, so reset to main's version.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread src/Sentry.AspNetCore/SentryTracingMiddleware.cs Outdated
Comment thread src/Sentry.AspNetCore/SentryAspNetCoreOptions.cs Outdated
Comment thread src/Sentry.AspNetCore/SentryTracingMiddleware.cs Outdated
Comment thread src/Sentry.AspNetCore/SentryTracingMiddleware.cs Outdated
Comment thread src/Sentry.AspNetCore/SentryTracingMiddleware.cs Outdated
@jamescrosswell jamescrosswell changed the title feat: Add AlwaysCallTransactionNameProvider option feat: Add PreferTransactionNameProvider option May 13, 2026
jamescrosswell and others added 3 commits May 13, 2026 12:08
…vider

Rename per code review feedback — the new name better expresses the semantic
(precedence over the route-derived name) rather than the implementation detail
(that the delegate is always called).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add LazyThreadSafetyMode.None (no thread contention here, avoids lock overhead)
- Revert transaction.Name.Length == 0 -> == string.Empty (null-safe, consistent across TFMs)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PreferTransactionNameProvider sorts after MaxRequestBodySize (P > M),
not before AutoRegisterTracing where AlwaysCallTransactionNameProvider was.
Verify auto-updated the local files; committing the accepted snapshots.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread src/Sentry.AspNetCore/SentryTracingMiddleware.cs
@jamescrosswell
jamescrosswell requested a review from Flash0ver May 13, 2026 07:20
/// returns <c>null</c> or <see cref="string.Empty"/>, the routed name is preserved (or the URL-path
/// fallback applies when no route was resolved).
/// </remarks>
public bool PreferTransactionNameProvider { get; set; }

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added follow up issue to complete documentation:

@jamescrosswell
jamescrosswell merged commit f85611f into main Jul 6, 2026
37 checks passed
@jamescrosswell
jamescrosswell deleted the tnp-5123 branch July 6, 2026 22:49
jamescrosswell added a commit to getsentry/sentry-docs that referenced this pull request Jul 10, 2026
## DESCRIBE YOUR PR

Documents the new `PreferTransactionNameProvider` option added to the
ASP.NET Core integration in
[getsentry/sentry-dotnet#5159](getsentry/sentry-dotnet#5159),
along with the existing `TransactionNameProvider` option it modifies
(which was previously undocumented).

Both are added to the ASP.NET Core section of the .NET **Configuration
Options** page.

- Document `TransactionNameProvider` (callback used to name transactions
for requests that don't resolve to a route template)
- Document `PreferTransactionNameProvider` (bool, default `false`) —
controls whether the provider runs on every request or only as a
route-resolution fallback

closes: getsentry/sentry-dotnet#5349

> **Note for reviewers:** `availableSince` is set to `6.7.0` (the next
unreleased minor at time of writing). Assumes this matches the actual
release that ships
[getsentry/sentry-dotnet#5159](getsentry/sentry-dotnet#5159).

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
- [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE -->
- [x] Other deadline: Release of `sentry-dotnet v6.7.0`
- [ ] None: Not urgent, can wait up to 1 week+

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
added an urgent due date to it.
Thanks in advance for your help!

## PRE-MERGE CHECKLIST

*Make sure you've checked the following before merging your changes:*

- [x] Checked Vercel preview for correctness, including links
- [x] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TransactionNameProvider is never called for routed requests

3 participants