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

Implement the BatchingProcessor without polling #5107

Closed
wants to merge 16 commits into from

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Mar 25, 2024

Blocked by #5106 (this includes a cherry-pick of that PRs commit)

The batching log processor provides the base functionality where it batches received records to a configured limit and then exports them. It also provides "polling" functionality where record batches beyond certain time-limit are exported. This change implements the former.

OnEmit is implemented batch and flush when a full queue is reached. The ForceFlush and Shutdown methods are implemented to appropriately interact with this functionality.

The actual exporting functionality is stubbed until #5104 and #5105 are merged.

The addition of polling is planned for a follow up PR. See #5093 for how this will be extended to include polling.

Part of #5063

The BatchingProcessor is not expected to ultimately contain
configuration fields for queue size or export parameters (see open-telemetry#5093).
This will break TestNewBatchingProcessorConfiguration which tests the
configuration by evaluating the BatchingProcessor directly.

Instead, test the batchingConfig and rename the test to
TestNewBatchingConfig to match what is being tested.
@MrAlias MrAlias added area:logs Part of OpenTelemetry logs Skip Changelog PRs that do not require a CHANGELOG.md entry labels Mar 25, 2024
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Attention: Patch coverage is 76.07362% with 39 lines in your changes are missing coverage. Please review.

Project coverage is 83.8%. Comparing base (ba5d126) to head (fb5a901).

❗ Current head fb5a901 differs from pull request most recent head 616741a. Consider uploading reports for the commit 616741a to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #5107     +/-   ##
=======================================
- Coverage   83.8%   83.8%   -0.1%     
=======================================
  Files        248     248             
  Lines      16230   16382    +152     
=======================================
+ Hits       13602   13729    +127     
- Misses      2340    2360     +20     
- Partials     288     293      +5     
Files Coverage Δ
sdk/log/exporter.go 85.4% <81.3%> (-14.6%) ⬇️
sdk/log/batch.go 81.5% <71.5%> (+7.5%) ⬆️

... and 1 file with indirect coverage changes

sdk/log/batch.go Outdated
Comment on lines 120 to 121
// Cancel all exports and polling.
b.cancel()
Copy link
Member

@pellared pellared Mar 26, 2024

Choose a reason for hiding this comment

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

I am not sure why we should cancel pending exports. I think we should still give a chance to have them completed until export timeout is not reached. Cannot this lead to missing log records?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This cancels the context for the polling. This is not the context used in the last flush.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Cancel all exports and polling.
b.cancel()
// Cancel all subsequent exports and polling.
b.cancel()

@MrAlias MrAlias marked this pull request as draft March 26, 2024 17:50
@MrAlias
Copy link
Contributor Author

MrAlias commented Mar 29, 2024

Refactoring based on early received feedback from @pellared has restructured the code in a way that it can be broken into smaller PRs. I have merged this back into #5093 and plan to split from there. Closing.

@MrAlias MrAlias closed this Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:logs Part of OpenTelemetry logs Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants