Skip to content

Conversation

@jpnurmi
Copy link
Collaborator

@jpnurmi jpnurmi commented Nov 5, 2025

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.lifecycle breadcrumbs to .NET instead of reimplementing the logic with MAUI lifecycle callbacks:

}

public void AddBreadcrumb(Breadcrumb breadcrumb)
public void AddBreadcrumb(Breadcrumb breadcrumb, SentryHint hint)
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We always have a hint at the call site because the other overload creates an empty hint:

public void AddBreadcrumb(Breadcrumb breadcrumb) => AddBreadcrumb(breadcrumb, new SentryHint());

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (version6@d95347e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/Sentry/Internal/ScopeObserver.cs 0.00% 1 Missing ⚠️
src/Sentry/Scope.cs 0.00% 0 Missing and 1 partial ⚠️
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.
📢 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.

@jpnurmi jpnurmi force-pushed the feat/scope-observer-breadcrumb-hint branch from 6f64a10 to 744323a Compare November 5, 2025 09:08
@jpnurmi
Copy link
Collaborator Author

jpnurmi commented Nov 5, 2025

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.

@jpnurmi jpnurmi closed this Nov 5, 2025
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.

3 participants