Fix: Avoid replacing Transaction Name on ASP.NET Core by null or empty#1215
Fix: Avoid replacing Transaction Name on ASP.NET Core by null or empty#1215lucas-zimerman merged 24 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1215 +/- ##
==========================================
- Coverage 81.57% 80.13% -1.44%
==========================================
Files 212 212
Lines 7024 7029 +5
Branches 1463 1465 +2
==========================================
- Hits 5730 5633 -97
- Misses 846 955 +109
+ Partials 448 441 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Josh DeGraw <18509575+josh-degraw@users.noreply.github.com>
|
This transaction code is Driving Me Nuts 🤪 |
|
After further refactor, I made changes to account for the Event consumption process. In addition, I removed the sentry-dotnet/src/Sentry.AspNetCore/SentryMiddleware.cs Lines 98 to 108 in 0cd1584 I also removed the code to get the transaction name on TryStartTransaction since not always it would return a path, and since we do the same process afterwards with a higher chance to capture the correct name, I opted to remove it. Despite that, I left the following code as is And, routeData is nullable almost all the time when running Sentry.Samples.AspNetCore.MVC and it keeps throwing exceptions all the time, I left it as is since it resulted in a weird side effect of it setting the wrong Transaction Name to events . To conclude, as requested by @bruno-garcia I inverted the TransactionTracer finish logic, by first removing itself from the scope and then Capturing it. I left the code without any try/catch block since both Hub ConfigureScope and CaptureTransactions are already covered with a try/catch block. Sorry for the long explanation 😅 |
This fix does two issues is ASP.NET Core:
The second fix is important since transactions with null or Empty names get dropped.
sentry-dotnet/src/Sentry/SentryClient.cs
Lines 120 to 127 in 74312a4
Close #1212.