Conversation
Stop processing and drop telemetry when an event processor throws. Record callback_error outcomes for every supported category instead of sending potentially partially processed data. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Fixes
- [Callback Errors 3] Drop failed processor data ([#6142](https://github.com/getsentry/sentry-java/pull/6142))If none of the above apply, you can opt out of this check by adding |
📲 Install BuildsAndroid
|
Make the preceding marker PR available to the processor failure policy. Preserve the existing stack commits and leave failure behavior unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
Use the internal processor marker to continue processing after SDK-owned processor failures without recording callback_error losses. Keep customer processor failures fail-closed across events, transactions, replays, feedback, logs, and metrics. Cover scope and options registration, continued callbacks and delivery, logging without discard notifications, intentional drops, and span loss accounting. Clarify the customer-only failure policy in the changelog. Refs #6081 Co-Authored-By: Claude <noreply@anthropic.com>
| e, | ||
| "An exception occurred while processing log event by processor: %s", | ||
| processor.getClass().getName()); | ||
| if (!(processor instanceof SentryEventProcessor)) { | ||
| recordLostLogEvent(DiscardReason.CALLBACK_ERROR, eventBeforeProcessor); | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| if (event == null) { |
There was a problem hiding this comment.
Bug: When a transaction is dropped by a processTransaction event processor, the subsequent debug log message incorrectly attributes the drop to applyScope.
Severity: LOW
Suggested Fix
Update the debug log message to accurately reflect the source of the transaction drop. This could involve adding a separate log message within the processTransaction method when an exception occurs, or adding a check to differentiate between a drop from applyScope and a drop from processTransaction before logging.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: sentry/src/main/java/io/sentry/SentryClient.java#L564-L573
Potential issue: When a transaction is captured, if a scope event processor throws an
exception, the `processTransaction` method correctly returns `null` to drop the
transaction. However, a subsequent debug log message at `SentryLevel.DEBUG` incorrectly
states "Transaction was dropped by applyScope". This is misleading because the drop was
caused by the event processor in `processTransaction`, not by the `applyScope` method
itself. While the functional behavior of dropping the transaction and recording a
`CALLBACK_ERROR` is correct, the log message is inaccurate and could cause confusion
during debugging.
PR Stack (Callback Errors)
📜 Description
Drops the current telemetry item when a customer
EventProcessorthrows. Subsequent processors andbeforeSend*callbacks do not run, and the item is not sent or added to a batch.SDK-owned processors are identified by the internal
SentryEventProcessormarker from #6162. Their exceptions are logged, but processing continues with the current item, including subsequent processors andbeforeSend*callbacks. Nocallback_errorclient-report outcome orOnDiscardCallbacknotification is emitted for an SDK processor failure because the item is not dropped.Customer processor exceptions record
callback_erroroutcomes for errors, transactions and spans, replays, feedback, logs and log bytes, and metrics and metric bytes. Intentional processornullresults continue to useevent_processor, including for SDK-owned processors. Existing accounting for spans actually removed by a processor is preserved.The distinction applies regardless of registration through options or scope. Replay processors only run from options. The marker identifies the implementation hierarchy; customer subclasses of SDK processors inherit the marker.
💡 Motivation and Context
Continuing after a customer processor failure can send partially processed data, including data that the processor intended to scrub. Fail closed for customer code while preserving the existing continue-on-error behavior for SDK-owned processors. Client reports represent discarded telemetry, not internal exceptions that do not cause a drop.
💚 How did you test it?
./gradlew spotlessApply apiDump./gradlew :sentry:test --tests io.sentry.SentryClientTest --tests io.sentry.SentryClientInternalEventProcessorTest --tests io.sentry.ScopeTest --tests io.sentry.ScopesTest --tests io.sentry.clientreport.ClientReportTest --tests io.sentry.internal.eventprocessor.SentryEventProcessorTest :sentry:apiCheck :sentry:spotlessCheck— 588 tests passednullstill drop intentionally, and actual span removals retain their accounting. Before the SDK-specific guards, 15 new regression cases failed; all pass with the change.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
The final stack PR changes
beforeBreadcrumbexception handling. Profile/replay artifact cleanup and profile discard accounting remain separate follow-ups; this update only distinguishes SDK-owned and customer processors. Existing catch types are unchanged.