Skip to content

Commit a85374c

Browse files
committed
Added Feedbacks page under Telemetry with SDK processing details
1 parent b728484 commit a85374c

File tree

3 files changed

+144
-61
lines changed

3 files changed

+144
-61
lines changed

develop-docs/sdk/data-model/envelope-items.mdx

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -181,67 +181,9 @@ details.
181181

182182
### User Feedback
183183

184-
Item type `"feedback"`. This Item contains an [event payload](/sdk/data-model/event-payloads/) encoded in JSON, with an additional `feedback` context object.
184+
Item type `"feedback"` contains an event with a feedback context in the payload encoded in JSON.
185185

186-
Example payload:
187-
```json
188-
{
189-
"event_id": "9ec79c33ec9942ab8353589fcb2e04dc",
190-
"timestamp": "2011-05-02T17:41:36Z",
191-
"platform": "javascript",
192-
"level": "error",
193-
"contexts": {
194-
"feedback": {
195-
"contact_email": "[email protected]",
196-
"name": "John Smith",
197-
"message": "I love session replay!",
198-
"url": "https://sentry.io/replays/",
199-
"associated_event_id": "32fd1995636d446385016e2747623e11",
200-
"replay_id":"82840977e85b4ed3bc27f7b5b25cec15"
201-
}
202-
}
203-
}
204-
```
205-
206-
**Payload Attributes**
207-
208-
We only document attributes for the `contexts.feedback` object, which is **required**
209-
for this item type. For other attributes, see [Event Payloads](/sdk/data-model/event-payloads/).
210-
211-
`message`
212-
213-
: **String, required.** Comments of the user, describing what happened and/or sharing
214-
feedback. The max length is **4096 characters**.
215-
216-
`contact_email`
217-
218-
: *String, optional.* The email of the user who submitted the feedback. If excluded, Sentry attempts to fill this in with user context. Anonymous feedbacks (no name or email) are still accepted.
219-
220-
`name`
221-
222-
: *String, optional.* The name of the user who submitted the feedback. If excluded, Sentry attempts to fill this in with user context. Anonymous feedbacks (no name or email) are still accepted.
223-
224-
`url`
225-
226-
: *String, optional.* The URL of the webpage the user was on when submitting feedback.
227-
This may be used to search for or set alerts on feedback.
228-
229-
`associated_event_id`
230-
231-
: *UUID String, optional.* The identifier of an error event in the same project.
232-
Use this to explicitly link a related error in the feedback UI.
233-
234-
`replay_id`
235-
236-
: *UUID String, optional.* The identifier of a related Session Replay in the same
237-
project. Sentry uses this ID to render a Replay clip in the feedback UI.
238-
239-
**Attaching Screenshots:**
240-
241-
You can associate screenshots with a feedback by sending image data as
242-
[attachment items](/sdk/data-model/envelope-items/#attachment), with `event_id`
243-
corresponding to the feedback item. We recommend sending the items in the same
244-
Envelope.
186+
See the <Link to="/sdk/telemetry/feedbacks/">feedback</Link> documentation for the payload details.
245187

246188
**Constraints:**
247189

develop-docs/sdk/expected-features/rate-limiting.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ While these [data categories](https://github.com/getsentry/relay/blob/master/rel
9292
- `attachment`: Attachment bytes stored (unused for rate limiting)
9393
- `session`: Session update events
9494
- `profile`: Profiling events
95+
- `profile_chunk`: Continuous Profiling chunks
9596
- `replay`: Session Replays
97+
- `feedback`: User Feedbacks
9698
- `metric_bucket`: Sentry Metrics sent via the `statsd` or `metrics` items. The `namespaces` component of the *quota_limit* defines which namespace(s) will be affected.
9799
- `internal`: a sentry/system internal event[^internal]
98100

99-
100101
- **Scope**: The unit / model in Sentry that quotas are enforced for.
101102
- `organization`
102103
- `project`
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
---
2+
title: Feedbacks
3+
sidebar_order: 4
4+
---
5+
6+
This document is meant for Sentry SDK developers and maintainers of the Feedback ingestion pipeline.
7+
8+
## Feedback Protocol
9+
10+
Item type `"feedback"`. This Item contains an [event payload](/sdk/data-model/event-payloads/) encoded in JSON, with an additional `feedback` context object.
11+
12+
## `"feedback"` Item
13+
14+
### Feedback Context Attributes
15+
16+
| Key | Type | Description |
17+
| ---------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
18+
| message | string | Required. Comments of the user, describing what happened and/or sharing feedback. The max length is **4096 characters**. |
19+
| contact_email | string | The email of the user who submitted the feedback. If excluded, Sentry attempts to fill this in with user context. Anonymous feedbacks (no name or email) are still accepted. |
20+
| name | string | The name of the user who submitted the feedback. If excluded, Sentry attempts to fill this in with user context. Anonymous feedbacks (no name or email) are still accepted. |
21+
| url | string | The URL of the webpage the user was on when submitting feedback. This may be used to search for or set alerts on feedback. |
22+
| associated_event_id | string | The identifier of an error event in the same project. Use this to explicitly link a related error in the feedback UI. |
23+
| replay_id | string | The identifier of a related Session Replay in the same project. Sentry uses this ID to render a Replay clip in the feedback UI. |
24+
25+
### Event Event Attributes
26+
27+
For the full list of attributes, see [Event Payloads](/sdk/data-model/event-payloads/).
28+
29+
| Key | Type | Description |
30+
| -------------------------- | ------ | ------------------------------------------------ |
31+
| timestamp | number | UNIX timestamp of the current time (in seconds). |
32+
| event_id | string | This should be the same as `replay_id` |
33+
| dist | string | - |
34+
| platform | string | - |
35+
| environment | string | - |
36+
| release | string | - |
37+
| user.id | string | - |
38+
| user.username | string | - |
39+
| user.email | string | - |
40+
| user.ip_address | string | - |
41+
| sdk.name | string | - |
42+
| sdk.version | string | - |
43+
| request.url | string | - |
44+
| request.headers.User-Agent | string | - |
45+
46+
### Example
47+
```json
48+
{
49+
"event_id": "9ec79c33ec9942ab8353589fcb2e04dc",
50+
"timestamp": "2011-05-02T17:41:36Z",
51+
"platform": "javascript",
52+
"level": "error",
53+
"contexts": {
54+
"feedback": {
55+
"contact_email": "[email protected]",
56+
"name": "John Smith",
57+
"message": "I love session replay!",
58+
"url": "https://sentry.io/replays/",
59+
"associated_event_id": "32fd1995636d446385016e2747623e11",
60+
"replay_id":"82840977e85b4ed3bc27f7b5b25cec15"
61+
}
62+
}
63+
}
64+
```
65+
66+
### Attaching Screenshots
67+
68+
You can associate screenshots with a feedback by sending image data as
69+
[attachment items](/sdk/data-model/envelope-items/#attachment), with `event_id`
70+
corresponding to the feedback item. We recommend sending the items in the same
71+
Envelope.
72+
73+
## Full Envelope Example
74+
75+
```json
76+
{"event_id":"9ec79c33ec9942ab8353589fcb2e04dc","sent_at":"2024-03-19T15:18:27.581Z","sdk":{"name":"sentry.javascript.react","version":"7.105.0"}}
77+
{"type":"feedback"}
78+
{
79+
"event_id": "9ec79c33ec9942ab8353589fcb2e04dc",
80+
"timestamp": "2011-05-02T17:41:36Z",
81+
"platform": "javascript",
82+
"level": "error",
83+
"contexts": {
84+
"organization": { "id": "0", "slug": "sentry" },
85+
"feedback": {
86+
"contact_email": "[email protected]",
87+
"name": "John Smith",
88+
"message": "I love session replay!",
89+
"url": "https://sentry.io/replays/",
90+
"associated_event_id": "32fd1995636d446385016e2747623e11",
91+
"replay_id":"82840977e85b4ed3bc27f7b5b25cec15"
92+
}
93+
},
94+
"environment": "prod",
95+
"release": "frontend@f00",
96+
"sdk": {
97+
"integrations": [
98+
"BrowserTracing",
99+
"BrowserProfiling",
100+
"Replay",
101+
"ReplayCanvas"
102+
],
103+
"name": "sentry.javascript.react",
104+
"version": "7.105.0"
105+
},
106+
"tags": {
107+
"sentry_version": "24.4.0.dev0",
108+
},
109+
"user": {
110+
"ip_address": "127.0.0.1",
111+
"email": "[email protected]",
112+
"id": 1,
113+
"name": "Admin"
114+
}
115+
}
116+
```
117+
118+
## Feedback SDK Pipeline
119+
120+
A feedback captured by capture_feedback is processed by the SDK. Note: The event can be discarded at any of the stages, at which point no further processing happens.
121+
122+
### BeforeSendFeedback
123+
124+
SDKs should implement a `beforeSendFeedback` callback to allow users to modify the feedback before it is sent. This callback should be similar to the existing [`beforeSend`](/sdk/expected-features/#before-send-hook) callback used for events.
125+
126+
### Scope Data and Event Processors
127+
128+
The scope is applied to the feedbacks, including tags, attachments, and trace context. The scope’s _event processors_ are invoked, too.
129+
130+
### Rate Limiting
131+
132+
[Rate limiting](/sdk/expected-features/rate-limiting/) is applied to feedbacks in the same way as it is applied to events.
133+
134+
### Dropped feedback reports
135+
136+
There is no sample rate for feedbacks, as they are always sampled. However, a feedback can be discarded at any of the pipeline stages. The SDK should report dropped feedbacks through [client reports](/sdk/telemetry/client-reports/).
137+
138+
### Session Replay Integration
139+
140+
SDKs are expected to flush the current Session Replay, if running. This ensures a meaningful replay recording exists and can be included in the `replay_id` attribute of the feedback context.

0 commit comments

Comments
 (0)