feat!: pass SentryHint to IScopeObserver#4694
Conversation
| } | ||
|
|
||
| public void AddBreadcrumb(Breadcrumb breadcrumb) | ||
| public void AddBreadcrumb(Breadcrumb breadcrumb, SentryHint hint) |
There was a problem hiding this comment.
question: nullability
Do we always have a Hint ... or are Hint optional?
I'm wondering whether this is OK to be non-nullable ... or it could/should be nullable.
There was a problem hiding this comment.
We always have a hint at the call site because the other overload creates an empty hint:
sentry-dotnet/src/Sentry/Scope.cs
Line 313 in 18ca31b
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## version6 #4694 +/- ##
===========================================
Coverage ? 73.18%
===========================================
Files ? 480
Lines ? 17422
Branches ? 3437
===========================================
Hits ? 12750
Misses ? 3821
Partials ? 851 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6f64a10 to
744323a
Compare
|
I'm having second thoughts about this. This was inspired by the use of hints to keep track of hybrid SDKs in the Java SDK, but I realized they are not passing hints to IScopeObserver.addBreadcrumb either. I had a prototype that associated Android Activity lifecycle breadcrumbs with a "native" hint in BeforeBreadcrumbCallback, synced them to .NET, and then checked the hint in AndroidScopeObserver to avoid syncing duplicates back to Java. However, the same can be achieved one level up in the scope, and instead of passing hints to the observer, one could simply not call the observer for breadcrumbs with such a "native" hint. |
Note
BREAKING CHANGE
This would allow us to associate hints with breadcrumbs originating from the native layer so that we could sync certain native breadcrumbs to .NET without pushing them back.
For example, the following proposal currently disables the Android activity lifecycle breadcrumbs from the Java SDK. With the hints available, it could selectively sync Android
ui.lifecyclebreadcrumbs to .NET instead of reimplementing the logic with MAUI lifecycle callbacks: