Skip to content

fix(collector): propagate context to reportProfile for graceful shutdown#1050

Merged
christos68k merged 4 commits into
open-telemetry:mainfrom
rogercoll:fix_reporter_ctx_propagation
Jan 8, 2026
Merged

fix(collector): propagate context to reportProfile for graceful shutdown#1050
christos68k merged 4 commits into
open-telemetry:mainfrom
rogercoll:fix_reporter_ctx_propagation

Conversation

@rogercoll
Copy link
Copy Markdown
Contributor

Previously, the collector's run loop triggered reportProfile using context.Background(). This detached the reporting process from the profiler's lifecycle context.

If the profiler/collector was stopped (cancelled) while a report was being processed, the underlying consumer would ignore the cancellation signal and continue running. This could lead to hanging goroutines or delays during application shutdown.

Updated the test to explicitly verify that the consumer respects the context cancellation.

@rogercoll rogercoll requested review from a team as code owners January 8, 2026 08:18
Comment thread reporter/collector_reporter_test.go Outdated
Co-authored-by: Christos Kalkanis <christos.kalkanis@elastic.co>
@christos68k christos68k merged commit e7c2162 into open-telemetry:main Jan 8, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants