Skip to content

Conversation

@dmitryax
Copy link
Member

@dmitryax dmitryax commented Oct 16, 2025

Introduce Entity, EntitySlice, and EntityAttributeMap types that provide a user-friendly interface for working with resource entities. The new API ensures consistency between entity and resource attributes by sharing the underlying attribute map, and prevents attribute conflicts between entities. This API should eventually replace the generated protobuf-based API for better usability.

Resolves #14042

@dmitryax dmitryax requested a review from a team as a code owner October 16, 2025 02:50
@dmitryax dmitryax requested a review from evan-bradley October 16, 2025 02:50
@github-actions github-actions bot requested a review from bogdandrutu October 16, 2025 02:50
@dmitryax dmitryax force-pushed the entity-helpers branch 2 times, most recently from 39ce4db to eae874d Compare October 16, 2025 02:57
@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

❌ Patch coverage is 97.41379% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.64%. Comparing base (71418b6) to head (0ec63be).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
pdata/xpdata/entity/entity_map.go 94.54% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14039      +/-   ##
==========================================
+ Coverage   91.61%   91.64%   +0.02%     
==========================================
  Files         655      658       +3     
  Lines       42793    42909     +116     
==========================================
+ Hits        39205    39322     +117     
+ Misses       2765     2764       -1     
  Partials      823      823              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmitryax dmitryax force-pushed the entity-helpers branch 6 times, most recently from c30ef53 to f85193f Compare October 17, 2025 23:54
Copy link
Member

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Nit:

Reading the Entity OTEP, I'm constantly reading the terms "Identifying" and "Descriptive". Would it make sense to keep the same terminology in the API to improve readability? I'm making code suggestions in just two parts of the code, but this would apply to all other appearances of ID and Description.

On the other hand, ID is shorter and easily understandable as well; feel free to ignore if you prefer the current naming.

dmitryax added a commit to dmitryax/opentelemetry-collector that referenced this pull request Oct 21, 2025
When entities are defined, mdatagen generates `AssociateWith{EntityType}()` methods on ResourceBuilder that associate resources with entity types using the entity refs API. The entities section is backward compatible - existing metadata.yaml files without entities continue to work as before.

This change is fully additive for now. The generated Go API is experimental and will change once open-telemetry#14039 is merged.
dmitryax added a commit to dmitryax/opentelemetry-collector that referenced this pull request Oct 21, 2025
When entities are defined, mdatagen generates `AssociateWith{EntityType}()` methods on ResourceBuilder that associate resources with entity types using the entity refs API. The entities section is backward compatible - existing metadata.yaml files without entities continue to work as before.

This change is fully additive for now. The generated Go API is experimental and will change once open-telemetry#14039 is merged.
dmitryax added a commit to dmitryax/opentelemetry-collector that referenced this pull request Oct 21, 2025
When entities are defined, mdatagen generates `AssociateWith{EntityType}()` methods on ResourceBuilder that associate resources with entity types using the entity refs API. The entities section is backward compatible - existing metadata.yaml files without entities continue to work as before.

This change is fully additive for now. The generated Go API is experimental and will change once open-telemetry#14039 is merged.
@dmitryax dmitryax force-pushed the entity-helpers branch 2 times, most recently from 014d3e9 to d2c8649 Compare October 21, 2025 19:33
Introduce `Entity`, `EntitySlice`, and `EntityAttributeMap` types that provide a user-friendly interface for working with resource entities. The new API ensures consistency between entity and resource attributes by sharing the underlying attribute map, and prevents attribute conflicts between entities. This API may eventually replace the generated protobuf-based API for better usability.
@dmitryax dmitryax added this pull request to the merge queue Oct 23, 2025
Merged via the queue into open-telemetry:main with commit 8038c69 Oct 23, 2025
60 checks passed
@dmitryax dmitryax deleted the entity-helpers branch October 23, 2025 21:19
@github-actions github-actions bot added this to the next release milestone Oct 23, 2025
dmitryax added a commit to dmitryax/opentelemetry-collector that referenced this pull request Nov 4, 2025
When entities are defined, mdatagen generates `AssociateWith{EntityType}()` methods on ResourceBuilder that associate resources with entity types using the entity refs API. The entities section is backward compatible - existing metadata.yaml files without entities continue to work as before.

This change is fully additive for now. The generated Go API is experimental and will change once open-telemetry#14039 is merged.
dmitryax added a commit to dmitryax/opentelemetry-collector that referenced this pull request Nov 4, 2025
When entities are defined, mdatagen generates `AssociateWith{EntityType}()` methods on ResourceBuilder that associate resources with entity types using the entity refs API. The entities section is backward compatible - existing metadata.yaml files without entities continue to work as before.

This change is fully additive for now. The generated Go API is experimental and will change once open-telemetry#14039 is merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[xpdata/entity] API to manage resource entity references that ensures data integrity

4 participants