opentelemetry-collector
opentelemetry-collector copied to clipboard
Add context propagation checks to component lifecycle tests
Description
This change introduces validation logic for context propagation during component lifecycle execution in the OpenTelemetry Collector.
A new helper (context_check_consumer.go) is added to assert context values during Start, Consume, and Shutdown. The code generation template was updated to inject context.WithValue(...) across all components. The metadata files were also fixed to pass schema validation for mdatagen.
Link to tracking issue
Fixes #13142
Testing
- Ran full test suite with go test ./... – all tests pass
- Verified injected context values are correctly propagated and asserted during lifecycle phases
Documentation
- Inline comments added to context_check_consumer.go
- Template updated with context injection logic for lifecycle tests
- Regenerated test files reflect the changes across receivers, processors, scrapers, and connectors
@dmathieu @dmitryax Just a follow-up to review. Thanks
This PR was marked stale due to lack of activity. It will be closed in 14 days.
Closed as inactive. Feel free to reopen if this PR is still being worked on.