[mdatagen] Ensure no conflict across extra_attributes in related entity refs#15012
[mdatagen] Ensure no conflict across extra_attributes in related entity refs#15012dmitryax wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
6bf6539 to
36b1e45
Compare
Merging this PR will not alter performance
|
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (85.71%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #15012 +/- ##
==========================================
+ Coverage 91.32% 91.33% +0.01%
==========================================
Files 697 697
Lines 44456 44468 +12
==========================================
+ Hits 40601 40617 +16
+ Misses 2716 2713 -3
+ Partials 1139 1138 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
36b1e45 to
af5a30c
Compare
Validate that no two entity definitions share the same `extra_attributes` resource attribute reference.
af5a30c to
087fa9b
Compare
| if _, ok := md.ResourceAttributes[ref.Ref]; !ok { | ||
| errs = errors.Join(errs, fmt.Errorf(`entity "%v": extra_attributes refers to undefined resource attribute: %v`, entity.Type, ref.Ref)) | ||
| } | ||
| if otherEntity, used := usedExtraAttrs[ref.Ref]; used { |
There was a problem hiding this comment.
Can this miss conflicts depending on entity order?
The new logic tracks only a single "first seen" owner per extra_attributes, I guess. Then checks conflicts only against that one owner.
This can create a false negative:
Entity Auses attrxEntity B(unrelated toA) also usesxEntity C(related toB, notA) usesx
At step 3, code compares only C and A, sees no relationship, and misses the real B and C conflict.
Validate that no two related entity definitions share the same
extra_attributesresource attribute reference.