opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

Add context propagation checks to component lifecycle tests

Open samuelarogbonlo opened this issue 5 months ago • 1 comments
trafficstars

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

samuelarogbonlo avatar Jun 09 '25 22:06 samuelarogbonlo

@dmathieu @dmitryax Just a follow-up to review. Thanks

samuelarogbonlo avatar Jun 11 '25 15:06 samuelarogbonlo

This PR was marked stale due to lack of activity. It will be closed in 14 days.

github-actions[bot] avatar Jun 29 '25 03:06 github-actions[bot]

Closed as inactive. Feel free to reopen if this PR is still being worked on.

github-actions[bot] avatar Jul 15 '25 03:07 github-actions[bot]