You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: develop-docs/sdk/telemetry/client-reports.mdx
+28-25
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,13 @@
2
2
title: Client Reports
3
3
sidebar_order: 2
4
4
---
5
-
## Scope and Intent
6
5
6
+
## Scope and Intent
7
7
8
8
Client reports (not to be confused with [User Feedback](https://docs.sentry.io/product/user-feedback/))
9
9
are a protocol feature that let clients send status reports
10
-
about themselves to Sentry. They are currently mainly used to emit outcomes
11
-
for events that were never sent. Chained relays are also able to emit these
10
+
about themselves to Sentry. They are currently mainly used to emit outcomes
11
+
for events that were never sent. Chained relays are also able to emit these
12
12
client reports to inform the next relay in chain about _some_ outcomes.
13
13
14
14
Due to a bug in Relay, which discards envelopes containing unknown envelope
@@ -17,21 +17,20 @@ items, the minimum required version of Sentry for client reports is
17
17
18
18
Before client reports were added there were no insights into the full number of events generated within applications instrumented with Sentry SDKs. It was always clear to track the number of events dropped on Sentry server side for any number of reason, but there was a gap in knowing just how many events were never sent from the SDKs at all. Are there patterns in different platforms? Are there problems we are not aware of? If a customer were to call Sentry and ask where there events are, we would have no answer, and no way to find out if there are truly missing events from their SDKs. Client reports removes some of this doubt. That being said we are not looking to perfectly measure every nuance and edge case of events being discarded in SDKs. It is more important to have a best effort and be able to gain insights to our SDKs and their host applications.
19
19
20
-
As seen here, we communicate *Accepted*, *filtered* and *dropped*, and now we can send a new type *discarded* (not displayed in product yet).
20
+
As seen here, we communicate _Accepted_, _filtered_ and _dropped_, and now we can send a new type _discarded_ (not displayed in product yet).
Client reports are sent as envelope items to Sentry, typically as separate
27
-
envelopes or with one of the already scheduled envelopes. They should not
28
-
be sent too frequently but not too infrequently either. Their main purpose
26
+
envelopes or with one of the already scheduled envelopes. They should not
27
+
be sent too frequently but not too infrequently either. Their main purpose
29
28
is to bring visibility into what is happening on the SDK side which affects
30
29
the user experience.
31
30
32
31
For instance SDKs might drop events in a few places in the SDK and this loss
33
-
of events can be invisible to a customer. Client reports let an SDK emit
34
-
such event outcomes to provide data about how often this is happening. For
32
+
of events can be invisible to a customer. Client reports let an SDK emit
33
+
such event outcomes to provide data about how often this is happening. For
35
34
instance SDKs might drop events if the transports hit their maximum internal
36
35
queue size, because rate limits instruct the SDK to drop events as they are
37
36
over quota etc.
@@ -89,6 +88,7 @@ The following discard reasons are currently defined for `discarded_events`:
89
88
90
89
-`queue_overflow`: a SDK internal queue (eg: transport queue) overflowed
91
90
-`cache_overflow`: an SDK internal cache (eg: offline event cache) overflowed
91
+
-`buffer_overflow`: an SDK internal buffer (eg. breadcrumbs buffer) overflowed
92
92
-`ratelimit_backoff`: the SDK dropped events because an earlier rate limit
93
93
instructed the SDK to back off.
94
94
-`network_error`: events were dropped because of network errors and were not retried.
@@ -101,7 +101,7 @@ The following discard reasons are currently defined for `discarded_events`:
101
101
-`backpressure`: an event was dropped due to downsampling caused by the system being under load
102
102
103
103
In case a reason needs to be added,
104
-
it also has to be added to the allowlist in [snuba](https://github.com/getsentry/snuba/blob/4e7cfdddcf7b93eacb762bc74ca2461cec9464e5/snuba/datasets/outcomes_processor.py#L24-L34).
104
+
it also has to be added to the allowlist in [snuba](https://github.com/getsentry/snuba/blob/1a2528dacaf7415f71866bf2602ce473832d938c/rust_snuba/src/processors/outcomes.rs#L15-L27).
105
105
106
106
Additionally the following discard reasons are reserved but there is no expectation
107
107
that SDKs send these under normal operation:
@@ -112,7 +112,7 @@ that SDKs send these under normal operation:
112
112
113
113
These function like `discarded_events` but identify events that were rate limited,
114
114
filtered or filtered by by dynamic sampling _at a relay_. Client SDKs must never
115
-
emit these _unless_ they are operating as a relay. The reason codes for these
115
+
emit these _unless_ they are operating as a relay. The reason codes for these
116
116
need to match the reason codes that relay would emit directly to Sentry.
117
117
118
118
### Special Case for Span Outcomes
@@ -123,18 +123,18 @@ If certain spans are dropped in `beforeSendTransaction`, an event processor etc.
123
123
124
124
```json
125
125
{
126
-
"discarded_events": [
127
-
{
128
-
"reason": "queue_overflow",
129
-
"category": "transaction",
130
-
"quantity": 1
131
-
},
132
-
{
133
-
"reason": "queue_overflow",
134
-
"category": "span",
135
-
"quantity": 3// 2 spans + 1 span (the transaction itself should be counted)
136
-
}
137
-
]
126
+
"discarded_events": [
127
+
{
128
+
"reason": "queue_overflow",
129
+
"category": "transaction",
130
+
"quantity": 1
131
+
},
132
+
{
133
+
"reason": "queue_overflow",
134
+
"category": "span",
135
+
"quantity": 3// 2 spans + 1 span (the transaction itself should be counted)
136
+
}
137
+
]
138
138
}
139
139
```
140
140
@@ -144,8 +144,9 @@ The client reports feature doesn't expect 100 percent correct numbers, and it is
144
144
acceptable for the SDKs to lose a small number of client reports. The expectation of
145
145
this feature is to give the users an approximation of specific outcomes. Of course,
146
146
the SDKs should ensure not dropping too many reports. It is not required, for example:
147
-
- to persist the data when an application crashes.
148
-
- to move an envelope item with a client report to the next envelope when the cache for envelopes is full.
147
+
148
+
- to persist the data when an application crashes.
149
+
- to move an envelope item with a client report to the next envelope when the cache for envelopes is full.
149
150
150
151
SDKs are encouraged to reduce needless communication. They shall not send an envelope
151
152
everytime they record a discarded event. The following approaches are recommendations
@@ -172,10 +173,12 @@ this feature is best-effort.
172
173
SDKs should provide a way to turn sending of client reports on and off. This option is called `send_client_reports` or `sendClientReports` on SDKs that have already implemented it.
173
174
174
175
### Legacy Events
176
+
175
177
For SDKs still sending legacy events instead of envelopes for backward compatibility with
176
178
older Sentry servers, the recommendation is to send the client report as a separate
177
179
envelope or attach it to pending session envelopes.
178
180
179
181
### Custom Transports
182
+
180
183
There is no expectation that such bookkeeping can work transparently for custom transports.
181
184
Consequently, it's acceptable if client reports are optional for custom transports.
0 commit comments