-
-
Notifications
You must be signed in to change notification settings - Fork 276
Description
Description
The Dart SDK attaches the client report before applying the rate limit in the client.
sentry-dart/dart/lib/src/sentry_client.dart
Lines 630 to 637 in 0880a97
| Future<SentryId?> _attachClientReportsAndSend(SentryEnvelope envelope) { | |
| final clientReport = _options.recorder.flush(); | |
| envelope.addClientReport(clientReport); | |
| return _taskQueue.enqueue( | |
| () => _options.transport.send(envelope), | |
| SentryId.empty(), | |
| ); | |
| } |
In the http_trasnport, it then applies the rate limit
sentry-dart/dart/lib/src/transport/http_transport.dart
Lines 37 to 42 in fe6dcac
| Future<SentryId?> send(SentryEnvelope envelope) async { | |
| final filteredEnvelope = _rateLimiter.filter(envelope); | |
| if (filteredEnvelope == null) { | |
| return SentryId.empty(); | |
| } | |
| filteredEnvelope.header.sentAt = _options.clock(); |
Because clients can assume that client reports never get rate limited (develop docs), the Dart SDK continues to send an envelope with a client report even when the SDK is fully rate-limited and should drop all envelope items. Instead, the Dart SDK should only add the client report envelope item if the envelope has items to send.
The downside of this is that when the SDK is fully rate-limited for a long time or the user drops all events in beforeSend, the SDK may never send a client report. This can be addressed by checking in the HTTP transport if the ClientReports has more than x discarded events (I guess 10 is a good start), and then send an envelope with only the client report. This is related to getsentry/sentry-cocoa#4468.
Metadata
Metadata
Assignees
Labels
Projects
Status