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

Feature: User Feedback #629

Closed
eaigner opened this issue Jul 20, 2020 · 5 comments · Fixed by #808 or #805
Closed

Feature: User Feedback #629

eaigner opened this issue Jul 20, 2020 · 5 comments · Fixed by #808 or #805

Comments

@eaigner
Copy link

eaigner commented Jul 20, 2020

I think what would give Sentry a huge edge would be the option to include user feedback. For instance, I have some crashes that I have no idea how to reproduce unless a user actually tells me what he did. Those traces are mostly from Apples system frameworks without any line of my apps code.

Here is my proposal:

In the config callback, let the user provide a reportDelegate like so

SentrySDK.start { options in
    options.dsn = "___PUBLIC_DSN___"
    options.crashReportDelegate = <MYDELEGATE>
}   

The delegate looks something like this

protocol SentryCrashReportDelegate {
    func sentryCreatedCrashReport(report: SentryCrashReport)
}

Now if this delegate was provided by the user, it is called when Sentry tries to upload a new crash report.

func sentryCreatedCrashReport(report: SentryCrashReport) {
    // The user/dev can open a custom report dialog here and could ask the user
    // if he wants to provide additional information.
    //
    // When he is done he calls `report.send()` or `report.discard()`
}

The SentryCrashReports interface looks basically like this

protocol SentryCrashReport {

    var reportURL: URL { get }
    var userFeedback: String? { get set }

    // other sentry related fields...

    /// Called when the user is finished modifying the report and wants to upload it
    func send()

    /// In case we want to discard this report.
    func discard()
}

If the userFeedback field was set, it could be attached as the last breadcrumb.

@bruno-garcia
Copy link
Member

Thanks for raising this.

Sentry supports Feedback and it's very common for JS users. It shows Sentry's user report modal.
There's a tab on the issues page solely for user feedback:
image

It doesn't need to be sent with the event itself, it can actually be captured after the fact and linked via the event-id.

We're planning to add this to the mobile SDKs sooner rather than later. We will update this issue with the progress.

@eaigner
Copy link
Author

eaigner commented Jul 21, 2020

Didnt know about that tab!

The important thing though would be that a) events and crashes can be associated with a certain feedback and b) the report interface can be completely customized and is not generated by the SDK itself.

@philipphofmann
Copy link
Member

philipphofmann commented Oct 20, 2020

@eaigner we just opened up a PR #805 for manually capturing user feedback like this

let userFeedback = UserFeedack(eventId: eventId)
userFeedback.comments = "It broke on macOS-Swift. I don't know why, but this happens."
userFeedback.email = "john@me.com"
userFeedback.name = "John Me"
SentrySDK.capture(userFeedback: userFeedback)

So you could already manually take care of attaching user feedback to an event. We have plans on adding a proper way to attach that on crashes in a user-friendly way. Still, you could already do something like this now:

SentrySDK.start { options in
    options.beforeSend = { event in
        if (event.level == .fatal) {
            displayUserFeedback(eventId: event.eventId)
        }
        return event
    }
}

// Not a sentry function. Only wraps call to user feedback
func displayUserFeedback(eventId: SentryId) {
    // Display UI and get feedback from the user.
        
    // Then send feedback to Sentry
    let userFeedback = UserFeedack(eventId: eventId)
    feedback.comments = "It broke"
    feedback.name = "John Smith"
    feedback.email = "john@smith.com"
    SentrySDK.capture(userFeedback: feedback)
}

Any feedback on this is appreciated.

@philipphofmann
Copy link
Member

philipphofmann commented Oct 21, 2020

We are currently working on a callback for crashes in #808. Together with user feedback, it would look like this:

SentrySDK.start { options in
    // ...
    
    options.onCrashedLastRun = { eventId in
        self.displayUserFeedback(eventId: eventId)
    }
}

// Not a sentry function. Only wraps call to user feedback
func displayUserFeedback(eventId: SentryId) {
		
    // Display UI and get feedback from the user. 

    // Then send feedback to Sentry
    let feedback = SentryUserFeedback(eventId: eventId)
    feedback.comments = "It broke"
    feedback.name = "John Smith"
    feedback.email = "john@smith.com"
    SentrySDK.capture(feedback: feedback)
}

Do you maybe have any inputs on this @eaigner ?

@philipphofmann philipphofmann linked a pull request Oct 21, 2020 that will close this issue
5 tasks
@philipphofmann philipphofmann linked a pull request Oct 22, 2020 that will close this issue
5 tasks
@philipphofmann
Copy link
Member

We just released #805. I think you can achieve now what you asked for @eaigner. I'm going to close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants