feat: Add BeforeSendFeedback callback to inspect, modify, or drop user feedback before it's sent#5361
Open
vladbrincoveanu wants to merge 3 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5361 +/- ##
==========================================
+ Coverage 74.14% 74.19% +0.04%
==========================================
Files 509 509
Lines 18386 18409 +23
Branches 3600 3603 +3
==========================================
+ Hits 13633 13658 +25
+ Misses 3880 3879 -1
+ Partials 873 872 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…r feedback before it's sent Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…semantics Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1f51fe2 to
7bbbb1c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refers to #4092
Summary
Adds a
BeforeSendFeedbackcallback toSentryOptions, mirroring the existingBeforeSendpattern but scoped to user feedback events. It lets applications inspect, modify, or drop user feedback before it is sent to Sentry.Changes
SetBeforeSendFeedbackoverloads onSentryOptions(with and withoutSentryHint), consistent withSetBeforeSend/SetBeforeSendTransaction.SentryEventHelper.DoBeforeSendFeedback, invoked inSentryClient.CaptureFeedbackafter event processors run.CaptureFeedbackResult.DroppedByBeforeSendFeedbackresult valueClientReportRecorderunderDiscardReason.BeforeSend/DataCategory.Feedback. Originally, was specified the use of DataCategory USER_REPORT_V2.[SDK docs] add new UF data model and implementation details under telemetry dev docs sentry#88232 (comment)
Behavior notes for reviewers
Assumption: Feedback is a common place to scrub PII, so a callback that cannot complete should not leak partially-scrubbed or unintended feedback.
Implementation: Both the null-return and throw paths record a client-report discard. This is documented on the public API and covered by tests.
Tests
SentryClientTestscovers: callback invocation + mutation passthrough, hint received from caller, null and throw drops feedback.Unrelated changes
Added a small unit test for CaptureFeedbackResult.UnknownError.