Skip to content

Commit 6e07826

Browse files
authored
feat(develop): Propose new discard reason for buffer overflow (#12395)
1 parent d61e27f commit 6e07826

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

develop-docs/sdk/telemetry/client-reports.mdx

+28-25
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Client Reports
33
sidebar_order: 2
44
---
5-
## Scope and Intent
65

6+
## Scope and Intent
77

88
Client reports (not to be confused with [User Feedback](https://docs.sentry.io/product/user-feedback/))
99
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
1212
client reports to inform the next relay in chain about _some_ outcomes.
1313

1414
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
1717

1818
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.
1919

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).
2121
![image](https://user-images.githubusercontent.com/47563310/166436813-8c92e6b2-acf0-4a81-9413-b94c9a178fbf.png)
2222

23-
2423
## Basic Operation
2524

2625
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
2928
is to bring visibility into what is happening on the SDK side which affects
3029
the user experience.
3130

3231
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
3534
instance SDKs might drop events if the transports hit their maximum internal
3635
queue size, because rate limits instruct the SDK to drop events as they are
3736
over quota etc.
@@ -89,6 +88,7 @@ The following discard reasons are currently defined for `discarded_events`:
8988

9089
- `queue_overflow`: a SDK internal queue (eg: transport queue) overflowed
9190
- `cache_overflow`: an SDK internal cache (eg: offline event cache) overflowed
91+
- `buffer_overflow`: an SDK internal buffer (eg. breadcrumbs buffer) overflowed
9292
- `ratelimit_backoff`: the SDK dropped events because an earlier rate limit
9393
instructed the SDK to back off.
9494
- `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`:
101101
- `backpressure`: an event was dropped due to downsampling caused by the system being under load
102102

103103
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).
105105

106106
Additionally the following discard reasons are reserved but there is no expectation
107107
that SDKs send these under normal operation:
@@ -112,7 +112,7 @@ that SDKs send these under normal operation:
112112

113113
These function like `discarded_events` but identify events that were rate limited,
114114
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
116116
need to match the reason codes that relay would emit directly to Sentry.
117117

118118
### Special Case for Span Outcomes
@@ -123,18 +123,18 @@ If certain spans are dropped in `beforeSendTransaction`, an event processor etc.
123123

124124
```json
125125
{
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+
]
138138
}
139139
```
140140

@@ -144,8 +144,9 @@ The client reports feature doesn't expect 100 percent correct numbers, and it is
144144
acceptable for the SDKs to lose a small number of client reports. The expectation of
145145
this feature is to give the users an approximation of specific outcomes. Of course,
146146
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.
149150

150151
SDKs are encouraged to reduce needless communication. They shall not send an envelope
151152
everytime they record a discarded event. The following approaches are recommendations
@@ -172,10 +173,12 @@ this feature is best-effort.
172173
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.
173174

174175
### Legacy Events
176+
175177
For SDKs still sending legacy events instead of envelopes for backward compatibility with
176178
older Sentry servers, the recommendation is to send the client report as a separate
177179
envelope or attach it to pending session envelopes.
178180

179181
### Custom Transports
182+
180183
There is no expectation that such bookkeeping can work transparently for custom transports.
181184
Consequently, it's acceptable if client reports are optional for custom transports.

0 commit comments

Comments
 (0)