-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Avoid replacing Transaction Name on ASP.NET Core by null or empty #1215
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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.