Skip to content

[mdatagen] Ensure no conflict across extra_attributes in related entity refs#15012

Open
dmitryax wants to merge 1 commit intoopen-telemetry:mainfrom
dmitryax:mdatagen-ensure-no-extra-attributes-conflict
Open

[mdatagen] Ensure no conflict across extra_attributes in related entity refs#15012
dmitryax wants to merge 1 commit intoopen-telemetry:mainfrom
dmitryax:mdatagen-ensure-no-extra-attributes-conflict

Conversation

@dmitryax
Copy link
Copy Markdown
Member

@dmitryax dmitryax commented Mar 26, 2026

Validate that no two related entity definitions share the same extra_attributes resource attribute reference.

@dmitryax dmitryax requested a review from a team as a code owner March 26, 2026 14:10
@dmitryax dmitryax requested a review from evan-bradley March 26, 2026 14:10
@dmitryax dmitryax changed the title [mdatagen] Ensure no conflict across extra_attributes in entity refs [mdatagen] Ensure no conflict across extra_attributes in related entity refs Mar 26, 2026
@dmitryax dmitryax force-pushed the mdatagen-ensure-no-extra-attributes-conflict branch from 6bf6539 to 36b1e45 Compare March 26, 2026 14:12
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 26, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 7 untouched benchmarks
⏩ 76 skipped benchmarks1


Comparing dmitryax:mdatagen-ensure-no-extra-attributes-conflict (087fa9b) with main (01ca829)

Open in CodSpeed

Footnotes

  1. 76 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.33%. Comparing base (c985f1f) to head (087fa9b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...datagen/internal/samplescraper/generated_config.go 0.00% 2 Missing ⚠️

❌ 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.
📢 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 mdatagen-ensure-no-extra-attributes-conflict branch from 36b1e45 to af5a30c Compare March 26, 2026 14:26
Validate that no two entity definitions share the same
`extra_attributes` resource attribute reference.
@dmitryax dmitryax force-pushed the mdatagen-ensure-no-extra-attributes-conflict branch from af5a30c to 087fa9b Compare March 26, 2026 14:43
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 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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:

  1. Entity A uses attr x
  2. Entity B (unrelated to A) also uses x
  3. Entity C (related to B, not A) uses x

At step 3, code compares only C and A, sees no relationship, and misses the real B and C conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants