open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.1k stars 2.39k forks source link

[receiver/k8sobjects] use same data structure for objects received via `pull` and `watch` mode #36432

Open bacherfl opened 3 days ago

bacherfl commented 3 days ago

Description

This PR ensures that the structure of log records generated by the k8sobjects receiver is the same, regardless of the mode (watch or pull) being used. This also solves the issue of the k8s.namespace.name attribute not being set for objects retrieved with watch mode.

Link to tracking issue

Fixes #36352

Testing

Added unit tests and adapted e2e tests