Skip to content

Conversation

@lcian
Copy link
Member

@lcian lcian commented Jun 6, 2025

Implements a batcher for logs.

  • The implementation is basically the same as the one for the SessionFlusher, with different thresholds.
  • As an optimization, we don't even create the batcher if enable_logs is false.
  • The flushing is implemented as per the spec initial suggestion of flushing every 100 items or 5 seconds. We could also use different thresholds though.
  • In the future we are going to change this implementation to use the batch processor approach, which will allow us to batch logs, spans (for span streaming) and possibly other telemetry data.

@getsentry getsentry deleted a comment from github-actions bot Jun 6, 2025
@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

Attention: Patch coverage is 84.45946% with 23 lines in your changes missing coverage. Please review.

Project coverage is 72.84%. Comparing base (5912203) to head (87c9b54).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #831      +/-   ##
==========================================
+ Coverage   72.62%   72.84%   +0.21%     
==========================================
  Files          63       64       +1     
  Lines        7597     7732     +135     
==========================================
+ Hits         5517     5632     +115     
- Misses       2080     2100      +20     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lcian lcian marked this pull request as ready for review June 6, 2025 09:41
@lcian lcian requested a review from Swatinem June 6, 2025 09:41
@github-actions
Copy link

github-actions bot commented Jun 6, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 87c9b54

@lcian lcian linked an issue Jun 6, 2025 that may be closed by this pull request
Copy link
Contributor

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

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

nice, looks good.

we are going to change this implementation to use the batch processor approach

Looking forward to this. would this mean that we end up with only one background thread (or maybe two if we count the transport thread)?

@lcian
Copy link
Member Author

lcian commented Jun 10, 2025

nice, looks good.

we are going to change this implementation to use the batch processor approach

Looking forward to this. would this mean that we end up with only one background thread (or maybe two if we count the transport thread)?

Yeah, exactly. At least for logs and spans, but I don't see why we wouldn't use it for sessions as well.

@lcian lcian merged commit cb7fc81 into master Jun 10, 2025
18 checks passed
@lcian lcian deleted the lcian/feat/logs-batching-clean branch June 10, 2025 09:56
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.

[Structured logging] Log batching

3 participants