processor/logstransform: don't tie converter loop to Start context#47841
Open
SAY-5 wants to merge 1 commit intoopen-telemetry:mainfrom
Open
processor/logstransform: don't tie converter loop to Start context#47841SAY-5 wants to merge 1 commit intoopen-telemetry:mainfrom
SAY-5 wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
component.Component.Start documents that the context passed in is cancelled shortly after Start returns, so any long-running operation must derive its own context from context.Background(). The log converter goroutine was wired to the Start context directly, which works by accident today (no caller cancels before the first record) but violates the contract and will silently stop processing the moment the collector starts stressing the startup path. Derive a dedicated context from context.Background(), cancel it via a shutdown hook, and pass that to startConverterLoop. Fixes open-telemetry#31140. Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com> Assisted-by: Claude Opus 4.7
Contributor
|
Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib. Important reminders:
A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better! |
This file contains hidden or 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
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:
component.Component.Startdocuments that the context passed in is cancelled shortly afterStartreturns, so any long-running goroutine must derive its own context fromcontext.Background(). The logstransform processor's converter loop was wired directly to theStartcontext, which works by accident today (no caller cancels before the first record) but violates the contract and could silently stop processing under a slow startup.Fix: derive a dedicated context from
context.Background(), cancel it via a shutdown hook, and pass that tostartConverterLoop.Link to tracking issue: Fixes #31140
Testing:
go test ./processor/logstransformprocessor/... -count=1 -shortpasses.Documentation: Added
.chloggen/31140-logstransform-long-lived-context.yamlunderbug_fix.Signed-off-by: SAY-5 SAY-5@users.noreply.github.com
Assisted-by: Claude Opus 4.7