-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
(batchprocessor): Multi/single-shard consistent start method and field names #11314
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11314 +/- ##
=======================================
Coverage 91.43% 91.44%
=======================================
Files 424 424
Lines 20264 20270 +6
=======================================
+ Hits 18529 18535 +6
Misses 1359 1359
Partials 376 376 ☔ View full report in Codecov by Sentry. |
bogdandrutu
approved these changes
Oct 1, 2024
jackgopack4
pushed a commit
to jackgopack4/opentelemetry-collector
that referenced
this pull request
Oct 8, 2024
…d names (open-telemetry#11314) #### Description There are two implementations of the `batcher` interface with several inconsistencies. Notably, the single-shard case would start a goroutine before `Start()` is called, which can be confusing when the goroutine leak checker notices it. This makes the single-shard batcher wait until Start() to create its single shard. A confusing field name `batcher` in this case becomes `single`, and a new field is added for use in start named `processor` to create the new shard. For the multi-shard batcher, `start()` does nothing, but this structure confusingly embeds the batchProcessor. Rename the field `processor` for consistency with the single-shard case. #### Link to tracking issue Part of open-telemetry#11308.
bogdandrutu
pushed a commit
that referenced
this pull request
Nov 4, 2024
…or (#11594) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description The single-shard batcher is currently created and started in the start function. If the consume function is called before the start function, sb.single will be nil and it will panic. I'm not sure if that can happen in the Otel collector but it might happen in distributions that have a different runtime (such as Alloy - Grafana's distribution). I think that conceptually, it's better to create the shard in the constructor and start it in the start function. PS: I did not create an entry in the changelog because the initial [PR](#11314) for this change didn't but let me know if I should add one. Credits also to @thampiotr for this fix
djaglowski
pushed a commit
to djaglowski/opentelemetry-collector
that referenced
this pull request
Nov 21, 2024
…or (open-telemetry#11594) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description The single-shard batcher is currently created and started in the start function. If the consume function is called before the start function, sb.single will be nil and it will panic. I'm not sure if that can happen in the Otel collector but it might happen in distributions that have a different runtime (such as Alloy - Grafana's distribution). I think that conceptually, it's better to create the shard in the constructor and start it in the start function. PS: I did not create an entry in the changelog because the initial [PR](open-telemetry#11314) for this change didn't but let me know if I should add one. Credits also to @thampiotr for this fix
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
There are two implementations of the
batcher
interface with several inconsistencies. Notably, the single-shard case would start a goroutine beforeStart()
is called, which can be confusing when the goroutine leak checker notices it. This makes the single-shard batcher wait until Start() to create its single shard. A confusing field namebatcher
in this case becomessingle
, and a new field is added for use in start namedprocessor
to create the new shard.For the multi-shard batcher,
start()
does nothing, but this structure confusingly embeds the batchProcessor. Rename the fieldprocessor
for consistency with the single-shard case.Link to tracking issue
Part of #11308.