Skip to content

processor/logstransform: don't tie converter loop to Start context#47841

Open
SAY-5 wants to merge 1 commit intoopen-telemetry:mainfrom
SAY-5:fix/logstransform-long-lived-context-31140
Open

processor/logstransform: don't tie converter loop to Start context#47841
SAY-5 wants to merge 1 commit intoopen-telemetry:mainfrom
SAY-5:fix/logstransform-long-lived-context-31140

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented Apr 21, 2026

Description:

component.Component.Start documents that the context passed in is cancelled shortly after Start returns, so any long-running goroutine must derive its own context from context.Background(). The logstransform processor's converter loop was wired directly to the Start context, 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 to startConverterLoop.

Link to tracking issue: Fixes #31140

Testing: go test ./processor/logstransformprocessor/... -count=1 -short passes.

Documentation: Added .chloggen/31140-logstransform-long-lived-context.yaml under bug_fix.

Signed-off-by: SAY-5 SAY-5@users.noreply.github.com
Assisted-by: Claude Opus 4.7

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
@SAY-5 SAY-5 requested review from a team and dehaansa as code owners April 21, 2026 23:43
@github-actions github-actions Bot added the first-time contributor PRs made by new contributors label Apr 21, 2026
@github-actions
Copy link
Copy Markdown
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!

@github-actions github-actions Bot added the processor/logstransform Logs Transform processor label Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time contributor PRs made by new contributors processor/logstransform Logs Transform processor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[processor/logstransform]: Long running tasks uses the wrong context

2 participants