-
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): Move single shard batcher creation to the constructor #11594
(batchprocessor): Move single shard batcher creation to the constructor #11594
Conversation
…nstead of the start function
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11594 +/- ##
=======================================
Coverage 91.57% 91.57%
=======================================
Files 441 441
Lines 23873 23873
=======================================
Hits 21861 21861
Misses 1640 1640
Partials 372 372 ☔ View full report in Codecov by Sentry. |
In the collector it cannot and Grafana uses the components wrong /cc @jpkrohling. The contract says here. Another problem is that Alloy is not a otel distribution if they don't respect collectors contracts. cc @jpkrohling FYI: I am ok with this change, but if in the future we break others because they do not respect the contract that is not considered a breaking change and fixes may not be approved/accepted. |
@wildum please add a changelog. |
You're right, we shouldn't depend on the implementation detail like this. We're working on a fix for this in Alloy and should be able to handle OTel component's lifecycle correctly. cc @jpkrohling |
Done. I put 'enhancement' because it's not a bug for the collector. Let me know if you prefer 'bug_fix'.
Thanks for pointing this out. We noticed this today while investigating the problem we had with the batch processor. We will work towards improving Alloy to respect the documented contracts. |
…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
…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
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 for this change didn't but let me know if I should add one.
Credits also to @thampiotr for this fix