Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new User Feedback API #4286

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

stefanosiano
Copy link
Member

📜 Description

Added new User Feedback APIs (Sentry.captureFeedback)

Still need to add tests

💡 Motivation and Context

Implements #3614

💚 How did you test it?

📝 Checklist

  • 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.

🔮 Next steps

Added Scopes.captureFeedback API

Changed the MainActivity sample app to use the new API
Copy link
Contributor

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Add new User Feedback API ([#4286](https://github.com/getsentry/sentry-java/pull/4286))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against c9b4850

Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 396.22 ms 413.09 ms 16.86 ms
Size 1.58 MiB 2.22 MiB 653.58 KiB

@stefanosiano stefanosiano marked this pull request as ready for review March 25, 2025 16:42
@stefanosiano stefanosiano marked this pull request as draft March 25, 2025 16:42
@stefanosiano stefanosiano marked this pull request as ready for review March 27, 2025 17:27
@kahest kahest linked an issue Mar 27, 2025 that may be closed by this pull request
Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

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

LGTM!

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

// Specs can be found at https://develop.sentry.dev/sdk/data-model/envelope-items/#user-feedback
Copy link
Member

Choose a reason for hiding this comment

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

nice!

@@ -160,7 +160,8 @@ private boolean shouldApplyScopeData(final @NotNull CheckIn event, final @NotNul
scope != null ? scope.withSession((@Nullable Session session) -> {}) : null;
@Nullable Session session = null;

if (event != null) {
// Feedbacks shouldn't be sampled, and they don't affect sessions
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to exclude it from beforeSend/EventProcessors and shall we apply the scope data? In web feedbacks I only see tags being applied, so I imagine everything else is redundant?

Copy link
Member

Choose a reason for hiding this comment

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

After reading the internal thread, I'm thinking we should rather introduce a new method in SentryClient (captureFeedback) that only does the necessary things for the feedback envelope item type, wdyt? Just to make it easier to distinguish

Copy link
Member Author

Choose a reason for hiding this comment

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

agree, but i'll wait a little until docs are updated

captureFeedback does not update scope lastEventId anymore
SentryEvent event = new SentryEvent();
event.getContexts().setFeedback(feedback);

return captureEvent(event, scope, hint);
Copy link
Member

Choose a reason for hiding this comment

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

I've also read in the iOS docs that when feedback is capture, we also capture an ongoing replay. So I think you'd have to call options.getReplayController().captureReplay(false); in the new captureFeedback method.

Copy link
Member Author

@stefanosiano stefanosiano Mar 31, 2025

Choose a reason for hiding this comment

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

that one is talking about the UI widget, to capture the replay the makes the user send the feedback.
I don't think we should add it to the API itself, but only when using the widget (which will come later)
wdyt?

Copy link
Member

@romtsn romtsn Mar 31, 2025

Choose a reason for hiding this comment

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

hm, I'd expect it to work even if I had my own widget to submit feedbackv2 I guess... but that's another point to clarify and align on with other sdks maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added it to the questions 👍

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.

Implement new user feedback API
3 participants