Skip to content

fix(core): [Callback Errors 8] Report dropped profiles - #6166

Draft
adinauer wants to merge 3 commits into
fix/callback-error-handling-replay-samplingfrom
fix/callback-error-handling-profile-accounting
Draft

adinauer wants to merge 3 commits into
fix/callback-error-handling-replay-samplingfrom
fix/callback-error-handling-profile-accounting

Conversation

@adinauer

@adinauer adinauer commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Callback Errors)


📜 Description

Record one callback_error/profile loss when an attached transaction profile is dropped because beforeSendTransaction or a customer event processor throws. The same accounting path notifies OnDiscardCallback.

Pass profile presence into the private transaction-processing helpers so scope and options processors both account for the loss. Transactions without profiles do not report profile losses. SDK processor failures continue sending the transaction and attached profile without reporting a loss.

Existing transaction/span accounting, intentional-drop behavior, and catch types are unchanged. This does not change profile-file cleanup or continuous profile chunks.

💡 Motivation and Context

Transaction callback failures already record the lost transaction and spans, but omit an attached profile that is dropped with them. Include that profile so client reports and discard observers reflect the full loss.

💚 How did you test it?

  • ./gradlew spotlessApply apiDump
  • ./gradlew :sentry:apiCheck :sentry:spotlessCheck :sentry:test --tests='*SentryClientTest*' --tests='*SentryClientTransactionProfileTest*' --tests='*SentryClientInternalEventProcessorTest*' --tests='*ClientReportTest*' --info — 295 tests passed
  • All three attached-profile failure cases failed before the production fix and passed afterward.
  • Cover scope processors, options processors, and beforeSendTransaction, each with and without an attached profile. Assert exact client-report counts and discard notifications.
  • Verify SDK processor exceptions retain the attached profile and report no losses for both registration paths.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

Profile/replay artifact cleanup remains a separate follow-up. Callback-boundary catch-type changes remain deferred to the next major.

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

Record callback_error/profile when beforeSendTransaction or a customer
transaction processor throws and an attached profile is dropped. Notify
OnDiscardCallback through the same client-report accounting path.

Cover scope and options processors, absent profiles, and SDK processor
failures that retain profiles. Leave catch types, intentional drops,
and profile-file cleanup unchanged.

Refs #6081
Co-Authored-By: Claude <noreply@anthropic.com>
Link the transaction profile loss accounting entry to PR #6166.

Co-Authored-By: Claude <noreply@anthropic.com>
@sentry

sentry Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.57.0 (1) release

⚙️ sentry-android Build Distribution Settings

Merge #6165 forward into #6166 without rewriting stack history.
Preserve attached-profile loss accounting alongside the sampler fixes.

Refs #6166
Co-Authored-By: Claude <noreply@anthropic.com>
adinauer added a commit that referenced this pull request Sep 25, 2026
Merge #6166 forward into #6167 without rewriting stack history.
Preserve integration callback guards alongside the updated sampler behavior.

Validate the combined core and OpenTelemetry suites, formatting, and API checks.

Refs #6167
Co-Authored-By: Claude <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant