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

Enhancing k8sattributesprocessor for Multi-Dimensional Metrics Collection #36437

Open tomatopunk opened 3 days ago

tomatopunk commented 3 days ago

Component(s)

processor/k8sattributes

Is your feature request related to a problem? Please describe.

Currently, the k8sattributesprocessor retrieves the pod identifier value from a single resource attribute. However, in many scenarios, this is not sufficient.

For example, while the collection target might be a node or machine, the metrics collected could be at the container level or related to specific Kubernetes resources, such as pods, containers, or even PVs and PVCs, as seen with tools like google/cAdvisor and kubelet.

Describe the solution you'd like

We need to add an attribute scope before inserting metadata, such as labels or container IDs. By introducing this attribute scope, we can prioritize resource attribute scopes effectively.

Describe alternatives you've considered

No response

Additional context

No response

github-actions[bot] commented 3 days ago

Pinging code owners:

tomatopunk commented 3 days ago

@dmitryax @fatsheep9146 @TylerHelmuth What do you think? I'm really excited to complete this feature.