Broadening the support for Kubernetes semantic conventions and k8sobjectsreceiver

The OpenTelemetry K8s SIG has introduced new semantic conventions for replication controllers, horizontal pod autoscalers, persistent volumes and their claims, resource quotas and more. We added support for them in Dash0, alongside first-class support for the k8sobjectsrecevier and its (non semconv-compliant...) output.

Author:
Michele Mancioppi

New resource types

We added new resource types and the associated resource equality, typing and naming rules: k8s.replicationcontroller, k8s.service, k8s.persistentvolume, k8s.persistentvolumeclaim, k8s.hpa, and k8s.resourcequota. We also added a new, generic k8s.object resource type for all Kubernetes resource types (including CRDs) that do not currently have semantic conventions, which is necessary to improve the experience with the k8sobjectsreceiver of the OpenTelemetry Collector.

Improving the experience with the k8sobjectsreceiver

The k8sobjectsreceiver sends one log record for each Kubernetes API state change it observes (object created, modified, or deleted), or a periodic snapshot in pull mode. Taking some liberties with the encoding (thankfully, OTLP/YAML is not a thing):

sample-k8sobjectsreceiver.yaml
ResourceLogs:
  Resource:
    k8s.namespace.name: dash0-validation
  ScopeLogs:
    scope.name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sobjectsreceiver
    LogRecords:
    - timestamp: 1970-01-01T00:00:00Z           # receiver leaves it zero
      severity_number: Unspecified              # receiver has no Event knowledge
      severity_text: ""
      event_name: ""
      attributes:
        k8s.resource.name: events
        event.domain: k8s
        event.name: bad-image.18b32f4314df584e  # verbatim Event.metadata.name
      body:                                     # watch mode
        type: MODIFIED
        object:
          apiVersion: events.k8s.io/v1
          kind: Event
          metadata:
            name: bad-image.18b32f4314df584e
            namespace: dash0-validation
            uid: 75309f4a-a6e9-4250-afa8-447ce7afdbe8
            resourceVersion: "508"
            creationTimestamp: "2026-05-26T17:57:22Z"
          regarding:
            apiVersion: v1
            kind: Pod
            name: bad-image
            namespace: dash0-validation
            uid: 91551565-71f9-4d88-9711-3bef7607a7a7
            fieldPath: spec.containers{bad}
            resourceVersion: "508"
          reason: BackOff
          note: 'Back-off pulling image "this-image-does-not-exist.example.com/never:latest"'
          eventTime: "2026-05-26T17:57:22Z"
          reportingController: kubelet
          reportingInstance: node-3
          type: Normal

Since the only resource attribute is k8s.namespace.name, this log used to be associated with a k8s.namespace resource, alongside all others representing new versions of resources in the same namespace. Instead, we now extract from the body of the log additional k8s.* resource attributes:

what-you-find-in-dash0.yaml
ResourceLogs:
  Resource:
    k8s.namespace.name: dash0-validation            # from regarding.namespace
    k8s.pod.name:       bad-image                   # per-Kind promotion
    k8s.pod.uid:        91551565-71f9-4d88-9711-3bef7607a7a7
    k8s.node.name:      node-3                      # from reportingInstance / source.host
    # (k8s.object.* generic keys removed: Pod has dedicated semconv)
  ScopeLogs:
    scope.name: github.com/dash0hq/dash0-opentelemetry-collector/processor/dash0k8sobjectprocessor
    LogRecords:
      event_name: k8s.object                        # this makes the log available for Annotations!
      # The rest is the same

That is, you are going now to find your new versions of Pods and Deployments when you filters for those pods and deployments.

Additionally, since we replace the bogus event_name field with k8s.object, you can use these logs for dashboard annotations, and can overlay how your Kubernetes resources change to your telemetry!

We also added support to normalizing the format for Kubernetes events as reported by k8sobjectsreceiver to the format we already supported of k8seventsreceiver (because, for Kubernetes, events are resources the way a pod or a deployment are), which means you can standardsize of k8sobjectsreceiver rather than using additionally k8seventsreceiver.

Last but not least, we papered over a papercut in k8seventsreceiver, which set timestamps based on the timezone where the collector is deployed in. Now it will all be consistently UTC.

Further reading