Skip to content

Conversation

@dmitryax
Copy link
Member

@dmitryax dmitryax commented Oct 20, 2025

While working on adding API for managing the Resource Entity references in collector pipelines, I found that it's very complicated to maintain data integrity if we don't explicitly impose the following restrictions on the data model:

  1. Entity Type Uniqueness: Enforces that all entities within a resource must have unique types, ensuring unambiguous identification and preventing ID attribute key collisions when combined with the prefix naming convention.

  2. Attribute Ownership: Ensures each resource attribute key is owned by at most one entity, preventing description attribute key collisions and data inconsistencies from multiple entities competing for control of the same attribute.

While working on adding API for managing the Resource Entity references in collector pipelines, I found that it's very complicated to maintain data integrity if we don't explicitly impose the following restrictions on the data model:

1. Entity Type Uniqueness: Enforces that all entities within a resource must have unique types, ensuring unambiguous identification and preventing  attribute key collisions when combined with the prefix naming convention.

2. Attribute Ownership: Ensures each resource attribute key is owned by at  most one entity, preventing data inconsistencies from multiple entities competing for control of the same attribute.
@dmitryax dmitryax force-pushed the add-entity-resource-integrity-restrictions branch from 17a3002 to faead7f Compare October 20, 2025 05:21
@dyladan
Copy link
Member

dyladan commented Oct 20, 2025

The uniqueness requirement at least I think is implied by the merge rules https://github.com/open-telemetry/opentelemetry-specification/blob/main/oteps/entities/0264-resource-and-entities.md#entity-merging-and-resource

I had thought the attribute ownership requirement was also in the OTEP but I can't find it.

In any case, I think this is overall a good idea to clarify and should be in the spec anyway not just oteps.

This is a draft so I'll hold off on review but +1 on the idea.

@dmitryax dmitryax marked this pull request as ready for review October 20, 2025 15:18
@dmitryax dmitryax requested review from a team as code owners October 20, 2025 15:18
Copy link
Contributor

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

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

Overall supportive of this. I think we need this definition here.

I do think we need to account for failure scenarios, so holding of an approval until we either add that section or mark a TODO to add that section.

otherwise compete for control of the same attribute.

For identifying attributes, ownership is implicitly enforced by the combination
of entity type uniqueness and the prefix naming convention. For descriptive
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 skeptical of relying on naming conventions here. I think we likely need something to describe what to do if folks fail to use our naming conventions going forward (it will happen, so we should make sure we don't get invalid Resources when it does, if we can help it.

In light of how other SDK/model behavior is - we should call out that this would be an error scenario in the model - and we'll be recommending SDKs have some kind of "error log + fallback" behavior.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I've added an Implementation Note to address validation and fallback strategies with given data model restrictions. Since this document isn't intended to provide SDK guidance as far as I understand, I kept it as a note rather than normative requirements.

On the naming convention strictness - the current semantic conventions already follow this pattern (host.id, k8s.node.uid, etc.). I'd prefer keeping the stricter requirement until we encounter concrete cases that break it during semantic convention development.

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants