Skip to content

Conversation

@ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Nov 26, 2025

Related to #3120

Changes

This PR adds roles for entity attributes that were missing this.

⚠️ Note that for k8s.namespace.name can be an identifying attribute within the scope of a K8s a cluster, hence k8s.namespace.uid is not defined at all nor used in k8sattributes processor of the Collector. I'd love to hear what people think about this and if we should consider introducing the k8s.namespace.uid as an identifying attribute for consistency across k8s resources/entities.

Merge requirement checklist

  • CONTRIBUTING.md guidelines followed.
  • Change log entry added, according to the guidelines in When to add a changelog entry.
    • If your PR does not need a change log, start the PR title with [chore]
  • Links to the prototypes or existing instrumentations (when adding or changing conventions)

@ChrsMark ChrsMark requested review from a team as code owners November 26, 2025 10:30
@github-actions github-actions bot added enhancement New feature or request area:k8s labels Nov 26, 2025
@ChrsMark ChrsMark self-assigned this Nov 26, 2025
@ChrsMark ChrsMark force-pushed the complete_k8s_entities branch from c88d0d0 to 26fcdd3 Compare November 26, 2025 10:36
@lmolkova lmolkova moved this from Untriaged to Awaiting codeowners approval in Semantic Conventions Triage Nov 28, 2025
@ChrsMark ChrsMark force-pushed the complete_k8s_entities branch from 26fcdd3 to e40da0f Compare December 2, 2025 10:40
@ChrsMark
Copy link
Member Author

ChrsMark commented Dec 2, 2025

/cc @open-telemetry/semconv-k8s-approvers

- ref: k8s.container.name
role: identifying
- ref: k8s.container.restart_count
role: identifying
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not certain we need to have this be identifying.

When grouping based on a k8s.container do I want to have restarts be considred separate containers?

It seems to me like you want to leverage a diffrent entity (like service.instance.id) to distinguish containers by restart. Or you need something like "Container instance" entity that would track this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When grouping based on a k8s.container do I want to have restarts be considred separate containers?

Hmm, I think you are right.

I remember the reason for having container's restart count both as an attribute and as a metric was to be able to use the attribute for identifying from which container instance a log was collected from. Specifically this is used for container's logs at https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/stanza/docs/operators/container.md#add-metadata-from-file-path (not sure if used in other places too).

I'll defer to @dmitryax here since he should remember more details.

It seems to me like you want to leverage a diffrent entity (like service.instance.id) to distinguish containers by restart. Or you need something like "Container instance" entity that would track this.

Probably for that purpose we could just use the container.id which k8sattributes processor can add if k8s.container.name is present? I can try and come-up with a configuration that verifies this.

Copy link
Member Author

@ChrsMark ChrsMark Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsuereth I have changed the k8s.container.restart_count to descriptive attribute. Thinking of it again, a k8s.container within the Pod's scope can be uniquely identified by its name: 37887f0

@dmitryax please confirm

Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
@ChrsMark ChrsMark force-pushed the complete_k8s_entities branch from e40da0f to 3f6451e Compare December 8, 2025 08:35
Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:k8s enhancement New feature or request

Projects

Status: No status
Status: Awaiting codeowners approval

Development

Successfully merging this pull request may close these issues.

2 participants