Skip to content

Conversation

denrase
Copy link
Collaborator

@denrase denrase commented Aug 27, 2025

📜 Description

https://develop.sentry.dev/sdk/telemetry/spans/batch-processor/

  • Only start timer once
  • Count payload size and flush after limit exceeded
  • Remove number based (200 logs) flushing

💡 Motivation and Context

Closes https://linear.app/getsentry/issue/MOBILE-1059/dart-flush-structured-logs-if-batch-size-exceeds-1mib

💚 How did you test it?

Unit tests

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

Copy link

linear bot commented Aug 27, 2025

Copy link

codecov bot commented Aug 27, 2025

Codecov Report

❌ Patch coverage is 88.63636% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.73%. Comparing base (0a52e23) to head (586b87a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/dart/lib/src/sentry_log_batcher.dart 81.48% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3211      +/-   ##
==========================================
- Coverage   87.86%   87.73%   -0.14%     
==========================================
  Files         289      289              
  Lines        9901     9932      +31     
==========================================
+ Hits         8700     8714      +14     
- Misses       1201     1218      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@denrase denrase marked this pull request as ready for review August 27, 2025 12:54
Copy link
Contributor

github-actions bot commented Aug 27, 2025

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1260.46 ms 1260.33 ms -0.13 ms
Size 5.53 MiB 5.97 MiB 453.78 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
81f83eb 1259.53 ms 1273.39 ms 13.86 ms
93b7728 1247.23 ms 1264.87 ms 17.64 ms
827bf09 1261.86 ms 1276.41 ms 14.55 ms
eca355d 1238.39 ms 1266.98 ms 28.59 ms
79f6b41 1269.33 ms 1279.71 ms 10.38 ms
dbd526b 1244.78 ms 1259.02 ms 14.24 ms
73dca78 1246.65 ms 1265.42 ms 18.76 ms
c26ed0a 1244.11 ms 1263.85 ms 19.75 ms
cc4e375 1253.06 ms 1263.81 ms 10.75 ms
b6c8720 1252.65 ms 1266.61 ms 13.96 ms

App size

Revision Plain With Sentry Diff
81f83eb 7.86 MiB 9.44 MiB 1.58 MiB
93b7728 7.86 MiB 9.44 MiB 1.58 MiB
827bf09 7.86 MiB 9.44 MiB 1.58 MiB
eca355d 7.86 MiB 9.44 MiB 1.58 MiB
79f6b41 7.86 MiB 9.44 MiB 1.58 MiB
dbd526b 7.86 MiB 9.44 MiB 1.58 MiB
73dca78 7.86 MiB 9.44 MiB 1.58 MiB
c26ed0a 5.53 MiB 5.97 MiB 453.76 KiB
cc4e375 7.86 MiB 9.44 MiB 1.58 MiB
b6c8720 7.86 MiB 9.44 MiB 1.58 MiB

Previous results on branch: enha/update-log-flushing

Startup times

Revision Plain With Sentry Diff
9ea6204 1242.60 ms 1256.29 ms 13.69 ms
b3cdf53 1250.39 ms 1255.48 ms 5.09 ms
5008b71 1234.47 ms 1237.60 ms 3.14 ms

App size

Revision Plain With Sentry Diff
9ea6204 5.53 MiB 5.97 MiB 453.78 KiB
b3cdf53 5.53 MiB 5.96 MiB 444.33 KiB
5008b71 5.53 MiB 5.97 MiB 453.78 KiB

Copy link
Contributor

github-actions bot commented Aug 27, 2025

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 444.61 ms 452.18 ms 7.57 ms
Size 13.93 MiB 14.93 MiB 1.00 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
0929dbf 462.82 ms 492.76 ms 29.94 ms
ec78888 457.94 ms 519.96 ms 62.02 ms
de377fd 572.35 ms 589.21 ms 16.87 ms
5b9a0da 446.94 ms 449.22 ms 2.28 ms
765aa8b 493.51 ms 531.23 ms 37.72 ms
3615e19 468.38 ms 504.71 ms 36.33 ms
8825ed8 447.65 ms 456.90 ms 9.25 ms
0fb45d0 482.79 ms 554.02 ms 71.23 ms
dbd526b 504.88 ms 569.02 ms 64.15 ms
f761369 462.73 ms 563.80 ms 101.06 ms

App size

Revision Plain With Sentry Diff
0929dbf 6.54 MiB 7.70 MiB 1.17 MiB
ec78888 6.54 MiB 7.69 MiB 1.15 MiB
de377fd 6.54 MiB 7.71 MiB 1.17 MiB
5b9a0da 13.93 MiB 14.93 MiB 1.00 MiB
765aa8b 6.54 MiB 7.70 MiB 1.16 MiB
3615e19 6.54 MiB 7.70 MiB 1.16 MiB
8825ed8 13.93 MiB 14.93 MiB 1.00 MiB
0fb45d0 6.54 MiB 7.70 MiB 1.17 MiB
dbd526b 6.54 MiB 7.69 MiB 1.15 MiB
f761369 6.54 MiB 7.70 MiB 1.16 MiB

Previous results on branch: enha/update-log-flushing

Startup times

Revision Plain With Sentry Diff
5008b71 439.40 ms 453.87 ms 14.47 ms
b3cdf53 449.48 ms 471.04 ms 21.56 ms
9ea6204 473.30 ms 473.44 ms 0.14 ms

App size

Revision Plain With Sentry Diff
5008b71 13.93 MiB 14.93 MiB 1.00 MiB
b3cdf53 13.93 MiB 14.93 MiB 1.00 MiB
9ea6204 13.93 MiB 14.93 MiB 1.00 MiB

Copy link
Contributor

@buenaflor buenaflor left a comment

Choose a reason for hiding this comment

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

what do you think of adding an option for configuring this?

@denrase
Copy link
Collaborator Author

denrase commented Aug 28, 2025

@buenaflor Don't think we should add an option to configure here. These are all behaviours/values where we have to follow the spec:

The BatchProcessor MUST start a timeout of 5 seconds when the SDK adds the first span or log.

@buenaflor
Copy link
Contributor

The SDK MAY choose a different value for the max batch size keeping the envelope max sizes in mind

we don't have to add a configurable option for it now but let's keep it in mind in case someone has a use case in the future

@denrase denrase requested a review from buenaflor August 28, 2025 12:04
@denrase denrase merged commit 75284dc into main Sep 1, 2025
137 checks passed
@denrase denrase deleted the enha/update-log-flushing branch September 1, 2025 10:44
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.

2 participants