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

Log a warning when envelope or items are dropped due to rate limiting #4148

Merged
merged 4 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### Fixes

- Log a warning when envelope or items are dropped due to rate limiting ([#4148](https://github.com/getsentry/sentry-java/pull/4148))
- Do not log if `OtelContextScopesStorage` cannot be found ([#4127](https://github.com/getsentry/sentry-java/pull/4127))
- Previously `java.lang.ClassNotFoundException: io.sentry.opentelemetry.OtelContextScopesStorage` was shown in the log if the class could not be found.
- This is just a lookup the SDK performs to configure itself. The SDK also works without OpenTelemetry.
Expand Down
9 changes: 7 additions & 2 deletions sentry/src/main/java/io/sentry/transport/RateLimiter.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ public RateLimiter(final @NotNull SentryOptions options) {
if (dropItems != null) {
options
.getLogger()
.log(SentryLevel.INFO, "%d items will be dropped due rate limiting.", dropItems.size());
.log(
SentryLevel.WARNING,
"%d envelope items will be dropped due rate limiting.",
dropItems.size());

// Need a new envelope
List<SentryEnvelopeItem> toSend = new ArrayList<>();
Expand All @@ -87,7 +90,9 @@ public RateLimiter(final @NotNull SentryOptions options) {

// no reason to continue
if (toSend.isEmpty()) {
options.getLogger().log(SentryLevel.INFO, "Envelope discarded due all items rate limited.");
options
.getLogger()
.log(SentryLevel.WARNING, "Envelope discarded due all items rate limited.");

markHintWhenSendingFailed(hint, false);
return null;
Expand Down
Loading