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

User Feedback Feature Request: Custom context #10916

Closed
lbernick opened this issue Mar 4, 2024 · 4 comments
Closed

User Feedback Feature Request: Custom context #10916

lbernick opened this issue Mar 4, 2024 · 4 comments

Comments

@lbernick
Copy link

lbernick commented Mar 4, 2024

Problem Statement

Use case: When an error occurs, we prompt the user for feedback and also for consent to upload diagnostic info. Diagnostic info is uploaded to cloud storage, and I'd like to associate the cloud storage URI with the event created in Sentry. This URI is only generated after the user consents to uploading diagnostics, so it's not available at the time of the crash. This is very similar to https://forum.sentry.io/t/updating-event-after-initial-upload/15057 but I didn't see a solution for that issue.

For user feedback that isn't related to a crash, we can do:

    Sentry.withScope(function (scope) {
      scope.setContext("Diagnostic Info", {
        URI: uri,
      })
      eventId = Sentry.captureMessage(`User Feedback from ${name}`)
    })
    const userFeedback = {
      event_id: eventId,
      name: name,
      email: email,
      comments: comments,
    }
    Sentry.captureUserFeedback(userFeedback)

However, for user feedback for a crash report, I don't see a way of attaching this context to the original event.

Workarounds:
I'd rather not do either of these options but I suppose they could work:

  • use "comments" field in user feedback api for jsonified context
  • create a global setting to opt in to diagnostics upload and automatically upload after a crash

Let me know if there are other options I should consider.

Alternatives:

  • Attachments for user feedback: This could work but the size of the diagnostic info is larger than Sentry's allowable attachment size.
  • Allow an event's context to be updated after creation.

Solution Brainstorm

No response

Product Area

User Feedback

@getsantry
Copy link

getsantry bot commented Mar 4, 2024

Assigning to @getsentry/support for routing ⏲️

@getsantry
Copy link

getsantry bot commented Mar 4, 2024

Routing to @getsentry/product-owners-user-feedback for triage ⏲️

@bruno-garcia
Copy link
Member

bruno-garcia commented Mar 4, 2024

Thanks for raising. This makes sense and on v8 of the JS SDK we plan to align the captureUserFeedback with the new sendFeedback that was created to send feedback outside errors (but ties to session replay etc).

@mydea
Copy link
Member

mydea commented May 28, 2024

in v8, you can add any data via the scope, which will be picked up by the feedback event like any other event.

You can do either this:

Sentry.captureFeedback(
  { message: "I really like your App, thanks!" },
  {
    captureContext: {
      tags: { key: "value" },
      extra: { key: "value" },
    },
  }
);

Or you can put data on the scope, which will be automatically picked up as well:

Sentry.withScope(scope => {
  scope.setTag('my-tag', 'value');
  Sentry.captureFeedback({ message: 'My feedback goes here!' });
});

@mydea mydea closed this as completed May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

5 participants