getsentry / sentry-docs

Sentry's documentation (and tools to build it)
https://docs.sentry.io
Other
336 stars 1.47k forks source link

UserFeedback needs clarification on getLastEventId and Handled vs Crashes #7407

Open thinkocapo opened 1 year ago

thinkocapo commented 1 year ago

Core or SDK?

Platform/SDK

Which part? Which one?

Android, Flutter, iOS

Description

Ask1: Docs for Android, iOS, Flutter say to Capture Message and then create a userFeedback object. Shouldn't you create the userFeedback object before you Capture a Message? This way it is on scope, similar to how you setTags and setBreadcrumbs before you Capture Message or Capture Exception.

https://docs.sentry.io/platforms/android/enriching-events/user-feedback/ https://docs.sentry.io/platforms/flutter/enriching-events/user-feedback/?original_referrer=https%3A%2F%2Fdocs.sentry.io%2Fplatforms%2Fandroid%2Fenriching-events%2Fuser-feedback%2F https://docs.sentry.io/platforms/apple/enriching-events/user-feedback/?original_referrer=https%3A%2F%2Fdocs.sentry.io%2Fplatforms%2Fandroid%2Fenriching-events%2Fuser-feedback%2F

SentryId sentryId = Sentry.captureMessage("My message");
UserFeedback userFeedback = new UserFeedback(sentryId);
userFeedback.setComments("It broke.");
userFeedback.setEmail("john.doe@example.com");
userFeedback.setName("John Doe");
Sentry.captureUserFeedback(userFeedback);

Update: I've re-read the docs, and it's clear "Sentry needs the eventId" so I guess Sentry.captureUserFeedback will send the feedback up to Sentry.io and Sentry.io will pair it to the event.

Ask2: Can you show code example of how to get the event Id? Docs say it is needed I heard there is some method like Sentry.getLastEventId() can we show that in docs here?

. For example, to get the eventId, you can use beforeSend or the return value of the method capturing an event. It is not intuitive nor does it look documented, for how to do this.

Or doesn't this work? eventId = Sentry.captureMessage("message") I'm not sure. Can we document how to do this?

Ask3: Do you use this the same way for both handled events and unhandled events? I was getting asked that. If app crashes, then when app restarts, will getLastEventId() have the eventId from the preceding crash? If you need to handle these differently, then let's document it or write some text about what to expect here. I kept getting asked, "Well what about crashes, because docs say captureMessage"

Suggested Solution

see asks

getsantry[bot] commented 1 year ago

Assigning to @getsentry/support for routing ⏲️

getsantry[bot] commented 1 year ago

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

markushi commented 1 year ago

Let's improve the docs and provide some shared content across platforms on how getLastEvent can be used in conjunction with user feedback.