Skip to content

Conversation

@denrase
Copy link
Collaborator

@denrase denrase commented Nov 13, 2025

📜 Description

This took some digging. I was testing sending logs in a tight loop and got rejected by the backend.

[Sentry] [debug] [1763038665.309155] [SentryRequestOperation:36] Request status: 400
[Sentry] [debug] [1763038665.309175] [SentryRequestOperation:42] Request response: {"detail":"envelope exceeded size limits for type 'log' (https://develop.sentry.dev/sdk/envelopes/#size-limits)"}

So I checked replay code. The issue is that it has 1000 logs MAX item limit, which is not in any documentation we used when implementing the log batching. Its documented here (https://develop.sentry.dev/sdk/telemetry/logs/#buffering)

Another issue I saw during testing is that envelopes persisted with > 1000 log items are being re-tried, so this is something that clients out there may be experiencing.

💡 Motivation and Context

Log envelopes dropped by the backend.

💚 How did you test it?

Unit tests. Sample app.

📝 Checklist

You have to check all boxes before merging:

  • 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.

Closes #6770

@denrase denrase changed the title Fix: Batch MAX 1000 logs Limit log batching to maximum 1000 logs per batch Nov 13, 2025
@denrase denrase marked this pull request as ready for review November 13, 2025 14:15
@denrase denrase added the ready-to-merge Use this label to trigger all PR workflows label Nov 13, 2025
@denrase
Copy link
Collaborator Author

denrase commented Nov 13, 2025

@philipphofmann @noahsmartin I'm thinking if we should also drop individual log item > 1MB or prune large attributes. WDYT?

@denrase denrase requested a review from itaybre November 13, 2025 14:26
@codecov
Copy link

codecov bot commented Nov 13, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
3926 1 3925 52
View the top 1 failed test(s) by shortest run time
iOS_Swift6_UITests.UITests::testLaunchAndCaptureError
Stack Traces | 0s run time
.../iOS-Swift6/iOS-Swift6-UITests/UITests.swift:11 - Failed to launch <XCUIApplicationImpl: 0x600000d00a20 io.sentry.sample.iOS-Swift6 at .../Products/TestCI-iphonesimulator/iOS-Swift6.app> via Xcode: Timed out while launching application via Xcode.

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@cleptric
Copy link
Member

Let's please cap this at 100, as in https://develop.sentry.dev/sdk/telemetry/logs/#buffering.
We can always raise limits at a later date, but lowering them is hard.
Yes, Relay technically allows up to 1000 items, but we aligned on 100 across SDKs.

@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1214.73 ms 1243.87 ms 29.14 ms
Size 24.14 KiB 1.01 MiB 1014.03 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
7273bf4 1202.42 ms 1227.62 ms 25.21 ms
8d944ac 1236.92 ms 1254.91 ms 18.00 ms
c6c1cb7 1235.71 ms 1263.80 ms 28.08 ms
a4c5ddc 1239.61 ms 1266.41 ms 26.80 ms
1bf44b4 1238.14 ms 1275.45 ms 37.31 ms
e0e5391 1191.21 ms 1243.14 ms 51.93 ms
7dabfb9 1227.55 ms 1243.94 ms 16.39 ms
cbbc82c 1246.43 ms 1266.13 ms 19.70 ms
aa96485 1215.37 ms 1234.04 ms 18.67 ms
4f36ea5 1216.87 ms 1246.34 ms 29.47 ms

App size

Revision Plain With Sentry Diff
7273bf4 23.75 KiB 908.01 KiB 884.26 KiB
8d944ac 23.75 KiB 919.69 KiB 895.94 KiB
c6c1cb7 23.75 KiB 928.15 KiB 904.40 KiB
a4c5ddc 23.75 KiB 977.30 KiB 953.55 KiB
1bf44b4 23.75 KiB 1021.20 KiB 997.45 KiB
e0e5391 23.74 KiB 1022.21 KiB 998.46 KiB
7dabfb9 23.75 KiB 980.80 KiB 957.05 KiB
cbbc82c 23.75 KiB 995.22 KiB 971.47 KiB
aa96485 23.75 KiB 874.46 KiB 850.71 KiB
4f36ea5 23.75 KiB 995.08 KiB 971.33 KiB

@denrase denrase changed the title Limit log batching to maximum 1000 logs per batch Limit log batching to maximum 100 logs per batch Nov 13, 2025
Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@denrase denrase enabled auto-merge (squash) November 13, 2025 15:57
@philipphofmann
Copy link
Member

Let's please cap this at 100, as in https://develop.sentry.dev/sdk/telemetry/logs/#buffering. We can always raise limits at a later date, but lowering them is hard. Yes, Relay technically allows up to 1000 items, but we aligned on 100 across SDKs.

I also added this as recommendation to getsentry/sentry-docs#15513

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Limit log batching to maximum 100 logs per batch

5 participants