Skip to content

Proposal: Define mapping from k8s well-known labels to semconv #236

@smithclay

Description

@smithclay

Many OpenTelemetry users run their applications in Kubernetes, where it is useful to use a collector processor like k8sattributes to enrich metrics, spans, or logs with k8s metadata like pod name.

The k8sattributes processor also supports enriching metrics, logs, and spans with resource attributes based on Kubernetes labels, including Well Known Labels. It would be helpful to OpenTelemetry users what the recommended best practice is for mapping well-known labels to OpenTelemetry resource attributes.

Two of the most obvious candidates (but open for feedback), are:

  • app.kubernetes.io/name -> service.name
  • app.kubernetes.io/version -> service.version

To configure k8sattributes to apply these rules, the collector YAML looks like this: https://github.com/lightstep/otel-collector-charts/blob/main/charts/otel-cloud-stack/values.yaml#L166-L168

It seems like these recommendations could (should?) live as an section in this doc: https://opentelemetry.io/docs/specs/otel/resource/semantic_conventions/k8s/

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions