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

fix(ourlogs): Add a class which batches groups of logs together. #4229

Merged
merged 27 commits into from
Apr 2, 2025

Conversation

colin-sentry
Copy link
Member

@colin-sentry colin-sentry commented Apr 1, 2025

Currently, sentry logs create a new envelope per-log, which is inefficient.

This changes the behavior to batch a large chunk of logs to be sent all at once.

Fixes #4155
Fixes #4225
Fixes #4152

@colin-sentry colin-sentry requested a review from a team as a code owner April 1, 2025 19:45
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

Attention: Patch coverage is 76.63551% with 25 lines in your changes missing coverage. Please review.

Project coverage is 79.48%. Comparing base (e4b8dae) to head (945dc46).
Report is 2 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/_log_batcher.py 76.19% 13 Missing and 7 partials ⚠️
sentry_sdk/client.py 75.00% 2 Missing and 2 partials ⚠️
sentry_sdk/types.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4229      +/-   ##
==========================================
- Coverage   79.49%   79.48%   -0.02%     
==========================================
  Files         141      142       +1     
  Lines       15808    15886      +78     
  Branches     2702     2716      +14     
==========================================
+ Hits        12567    12627      +60     
- Misses       2380     2394      +14     
- Partials      861      865       +4     
Files with missing lines Coverage Δ
sentry_sdk/__init__.py 100.00% <ø> (ø)
sentry_sdk/consts.py 92.85% <ø> (ø)
sentry_sdk/integrations/logging.py 82.89% <100.00%> (ø)
sentry_sdk/logger.py 100.00% <100.00%> (ø)
sentry_sdk/types.py 77.77% <66.66%> (+2.77%) ⬆️
sentry_sdk/client.py 78.84% <75.00%> (+0.01%) ⬆️
sentry_sdk/_log_batcher.py 76.19% <76.19%> (ø)

... and 2 files with indirect coverage changes

Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

After testing this PR locally, and some discussion outside of Github with Colin, and also because of the fact it is heavily based on the MetricsAggregator this is good to be merged.

@colin-sentry colin-sentry enabled auto-merge (squash) April 2, 2025 14:18
@antonpirker antonpirker changed the title feat(ourlogs): Add a class which batches groups of logs together. fix(ourlogs): Add a class which batches groups of logs together. Apr 2, 2025
@colin-sentry colin-sentry merged commit c254ba4 into master Apr 2, 2025
137 of 138 checks passed
@colin-sentry colin-sentry deleted the log_batcher branch April 2, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants