semantic-conventions icon indicating copy to clipboard operation
semantic-conventions copied to clipboard

Define rules for Kubernetes name and uid resource attributes

Open TylerHelmuth opened this issue 2 years ago • 1 comments
trafficstars

The existing Kubernetes resource attributes list specific groups, but it is not an exhaustive list. The way the semantic convention is written for k8s resource attributes today means that only the following object types are supported:

  • cluster
  • node
  • namespace
  • pod
  • container
  • replicaset
  • deployment
  • statefulset
  • daemonset
  • job
  • cronjob

There are other k8s object kinds, such as HorizontalPodAutoscaler or ConfigMap, as well as custom objects like the Instrumentation and OpenTelemetryCollector objects created by the OpenTelemetry Operator.

It would be good for the Semantic Convention for Kubernetes resource attributes to support a few "generic" rules that would apply to any Kubernetes object. A rule like k8s.{regarding.kind}.name and k8s.{regarding.kind}.uid would help.

Background Context: we want to extract some Kubernetes Events fields into meaningful resource attributes, but sometimes the objects associated with those events will not align with a defined semantic convention: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/24242

TylerHelmuth avatar Oct 19 '23 20:10 TylerHelmuth

There are other k8s object kinds, such as HorizontalPodAutoscaler or ConfigMap, as well as custom objects like the Instrumentation and OpenTelemetryCollector objects created by the OpenTelemetry Operator.

The truth is we keep adding SemConv for Resources' name, uid, label.* and annotation.* in a repeatitive way.

I'm not sure yet if generalising/templating is the best option here but we can give it some thought. I'm also not sure how this would be potentially affected by Entities.

Pinging for @open-telemetry/semconv-k8s-approvers and @open-telemetry/specs-semconv-approvers for feedback.

ChrsMark avatar Apr 30 '25 09:04 ChrsMark