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 envelope (Due: Dec 13) #4272

Open
armcknight opened this issue Aug 9, 2024 · 5 comments · May be fixed by #4535
Open

User Feedback envelope (Due: Dec 13) #4272

armcknight opened this issue Aug 9, 2024 · 5 comments · May be fixed by #4535
Assignees

Comments

@armcknight
Copy link
Member

armcknight commented Aug 9, 2024

Description

Package up the inputs from the form into the envelope format for transmission to the Sentry backend.

Old format Develop docs on user feedback envelope items: https://develop.sentry.dev/sdk/data-model/envelope-items/#user-feedback
New format: https://develop.sentry.dev/application/feedback-architecture/#feedback-events

Reference implementation: https://github.com/getsentry/sentry-javascript/blob/be9edf161f72bb0b9ccf38d70297b798054b3ce3/packages/feedback/src/core/sendFeedback.ts#L77-L116

Schema of the event envelope:

    event[”contexts”][”feedback”] = {
    "name": <user-provided>,
    "contact_email": <user-provided>,
    "message": <user-provided>,
    "url": <referring web page>,
    "source": <developer-provided, ex: "widget">,
    "associated_event_id": <developer-provided, should be a valid error event in the same project>

A more complete example from the javascript reference implementation:

  {
    "type": "feedback",
    "event_id": "d2132d31b39445f1938d7e21b6bf0ec4",
    "timestamp": 1597977777.6189718,
    "dist": "1.12",
    "platform": "javascript",
    "environment": "production",
    "release": 42,
    "tags": {"transaction": "/organizations/:orgId/performance/:eventSlug/"},
    "sdk": {"name": "name", "version": "version"},
    "user": {
        "id": "123",
        "username": "user",
        "email": "user@site.com",
        "ip_address": "192.168.11.12",
    },
    "request": {
        "url": None,
        "headers": {
            "user-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15"
        },
    },
    "contexts": {
        "feedback": {
            "message": "test message",
            "contact_email": "test@example.com",
            "type": "feedback",
        },
        "trace": {
            "trace_id": "4C79F60C11214EB38604F4AE0781BFB2",
            "span_id": "FA90FDEAD5F74052",
            "type": "trace",
        },
        "replay": {
            "replay_id": "e2d42047b1c5431c8cba85ee2a8ab25d",
        },
    },
  }

Reference implementation for image attachments: https://github.com/getsentry/sentry-javascript/blob/be9edf161f72bb0b9ccf38d70297b798054b3ce3/packages/feedback/src/screenshot/integration.ts#L31-L36

        const attachment: Attachment = {
           data,
           filename: 'screenshot.png',
           contentType: 'application/png',
           // attachmentType?: string;
         };
@armcknight
Copy link
Member Author

One thing to consider here is that we already have a method today to gather feedback: SentrySDK.captureUserFeedback We should keep that method for convenience and backwards compatibility.

However, SentryUserFeedback.eventId is currently a required property, which we want to move to becoming optional. That is public API, so changing it should be considered a major revision as anyone using it may encounter build breakages, if they are reading the property in Swift code, as it will become optional.

@kahest kahest moved this from Needs Discussion to Backlog in Mobile & Cross Platform SDK Aug 14, 2024
@armcknight
Copy link
Member Author

@armcknight armcknight linked a pull request Nov 15, 2024 that will close this issue
1 task
@armcknight armcknight linked a pull request Nov 15, 2024 that will close this issue
1 task
@armcknight
Copy link
Member Author

Continuing with #4272 (comment), eventId won't be optional, i'll just give it its own SentryId. But, email and name will become optional, and that would be a breaking change to the current SentryUserFeedback interface. I propose just adding a SentryUserFeedbackV2 interface.

@armcknight
Copy link
Member Author

Per feedback we'll just call it SentryFeedback

@armcknight armcknight changed the title User Feedback envelope User Feedback envelope (Due: Dec 13) Nov 19, 2024
@armcknight
Copy link
Member Author

Current status: got these to show up after sending them as their own events, here's an example with an attached screenshot (also has an attached image and log from the initial configured scope)
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Review
Development

Successfully merging a pull request may close this issue.

1 participant