Skip to content

fix(core): Apply byte category rate limits#5716

Merged
adinauer merged 8 commits into
mainfrom
fix/rate-limit-byte-categories
Jul 3, 2026
Merged

fix(core): Apply byte category rate limits#5716
adinauer merged 8 commits into
mainfrom
fix/rate-limit-byte-categories

Conversation

@adinauer

@adinauer adinauer commented Jul 3, 2026

Copy link
Copy Markdown
Member

Stacked on #5626.

📜 Description

Apply byte-category rate limits to the corresponding envelope item types. Log envelope items now respect log_byte limits, and trace metric envelope items now respect trace_metric_byte limits.

💡 Motivation and Context

Relay can rate limit logs and trace metrics by both item count and byte size. The SDK already parsed byte-category rate limits, but item filtering only checked log_item and trace_metric, so byte-only limits were stored without dropping the matching envelope item.

This change aligns SDK filtering with Relay's count-and-byte rate limit semantics.

💚 How did you test it?

  • ./gradlew :sentry:test --tests "io.sentry.transport.RateLimiterTest"
  • ./gradlew spotlessApply apiDump

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

tsushanth and others added 5 commits July 3, 2026 11:08
… discarded

Mirrors the LogByte pattern: records byte-level data category alongside the
item-level one when trace metrics are dropped by beforeSendMetrics, queue
overflow, or envelope discard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

@sentry

sentry Bot commented Jul 3, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.47.0 (1) release

⚙️ sentry-android Build Distribution Settings

@adinauer adinauer changed the base branch from fix-trace-metric-byte-data-category to main July 3, 2026 12:13
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 319.68 ms 375.92 ms 56.24 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
abfcc92 309.54 ms 380.32 ms 70.78 ms
4e3e79d 328.10 ms 395.64 ms 67.54 ms
8c1fb22 316.62 ms 352.78 ms 36.16 ms
b67bb28 307.59 ms 341.24 ms 33.65 ms
d15471f 361.89 ms 378.07 ms 16.18 ms
22f4345 313.52 ms 364.96 ms 51.44 ms
6727e14 337.22 ms 373.94 ms 36.71 ms
fc5ccaf 322.49 ms 405.25 ms 82.76 ms
22f4345 314.79 ms 375.02 ms 60.23 ms
2195398 319.02 ms 342.38 ms 23.36 ms

App size

Revision Plain With Sentry Diff
abfcc92 1.58 MiB 2.13 MiB 557.31 KiB
4e3e79d 0 B 0 B 0 B
8c1fb22 0 B 0 B 0 B
b67bb28 0 B 0 B 0 B
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
22f4345 1.58 MiB 2.29 MiB 719.83 KiB
6727e14 1.58 MiB 2.28 MiB 718.64 KiB
fc5ccaf 1.58 MiB 2.13 MiB 557.54 KiB
22f4345 1.58 MiB 2.29 MiB 719.83 KiB
2195398 0 B 0 B 0 B

Previous results on branch: fix/rate-limit-byte-categories

Startup times

Revision Plain With Sentry Diff
07e6983 340.86 ms 440.04 ms 99.18 ms

App size

Revision Plain With Sentry Diff
07e6983 0 B 0 B 0 B

@adinauer adinauer marked this pull request as ready for review July 3, 2026 12:55
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry/src/main/java/io/sentry/transport/RateLimiter.java

@adinauer adinauer merged commit 8a76183 into main Jul 3, 2026
69 of 70 checks passed
@adinauer adinauer deleted the fix/rate-limit-byte-categories branch July 3, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants