-
-
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: Ignore DiagnosticSource Integration if no Sampling available. #1238
Fix: Ignore DiagnosticSource Integration if no Sampling available. #1238
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1238 +/- ##
==========================================
+ Coverage 81.55% 81.57% +0.02%
==========================================
Files 212 212
Lines 6971 7024 +53
Branches 1454 1463 +9
==========================================
+ Hits 5685 5730 +45
- Misses 838 846 +8
Partials 448 448
Continue to review full report at Codecov.
|
test (triggering github actions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were the errant spans that were being created only happening for the SentryEFCoreListener
and the SentrySqlListener
?
src/Sentry.DiagnosticSource/Internals/DiagnosticSource/SentryEFCoreListener.cs
Outdated
Show resolved
Hide resolved
Yes |
…tps://github.com/getsentry/sentry-dotnet into fix/ignore-diagnosticsource-with-no-transactions
As discussed here https://discord.com/channels/621778831602221064/621792783316942878/896041457264259103 |
@lucas-zimerman i took the liberty of handling the merge conflict on the pr. But this looks good to me. A couple of minor comments above, but nothing that should block this one |
src/Sentry.DiagnosticSource/Internals/DiagnosticSource/SentryEFCoreListener.cs
Outdated
Show resolved
Hide resolved
test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs
Outdated
Show resolved
Hide resolved
…tps://github.com/getsentry/sentry-dotnet into fix/ignore-diagnosticsource-with-no-transactions
_diagnosticListener = DiagnosticListener.AllListeners.Subscribe(_subscriber); | ||
if (options.TracesSampleRate == 0) | ||
{ | ||
options.DiagnosticLogger?.Log(SentryLevel.Info, "DiagnosticSource Integration is now disabled due to TracesSampleRate being set to zero."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer LogInfo
instead of Log(Level.Info
if (options.TracesSampleRate == 0) | ||
{ | ||
options.DiagnosticLogger?.Log(SentryLevel.Info, "DiagnosticSource Integration is now disabled due to TracesSampleRate being set to zero."); | ||
options.DisableDiagnosticSourceIntegration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THe integration instance was already called, why mutate options after the fact to remove it?
It's probably best to remove this line
This PR solves two use cases.
The first issue is solved by disabling the integration during the application's startup if found that TracesSampleRate is set to zero.
The latter is fixed by not trying to retrieve/create a span if the current transaction is not being sampled.