Skip to content

Conversation

Frapschen
Copy link
Contributor

Description

I have a use case, I define an attribute and try to use it in telemetry.metric however I encounter an error: unused attributes: [xxx]
So, I push this PR to enhance the validateMetrics() func to support validate metrics in telemetry.metric

Link to tracking issue fix #10925

Fixes #

Testing

Documentation

@Frapschen Frapschen requested review from a team and TylerHelmuth August 22, 2024 07:18
}
errs = errors.Join(errs, md.validateAttributes(usedAttrs))
errs = errors.Join(errs, validateMetrics(md.Metrics, md.Attributes, usedAttrs),
validateMetrics(md.Telemetry.Metrics, md.Attributes, usedAttrs),
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @Frapschen, is there already a unit test that covers this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, please see the changed file cmd/mdatagen/testdata/unused_attribute.yaml, it will make sure the attributes that are used in telemetry.metric will not encounter unused attributes: [xxx] error.

Copy link

codecov bot commented Aug 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.19%. Comparing base (3612194) to head (2d13c6b).
Report is 52 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10942      +/-   ##
==========================================
- Coverage   92.21%   92.19%   -0.03%     
==========================================
  Files         405      405              
  Lines       19240    19245       +5     
==========================================
  Hits        17743    17743              
- Misses       1130     1133       +3     
- Partials      367      369       +2     

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

@Frapschen Frapschen requested a review from codeboten August 23, 2024 03:16
@Frapschen
Copy link
Contributor Author

Hi @codeboten, PTAL thanks!

@Frapschen
Copy link
Contributor Author

@codeboten just a friendly ping. Please review again.

@codeboten codeboten merged commit 5fc39ba into open-telemetry:main Sep 12, 2024
49 checks passed
@github-actions github-actions bot added this to the next release milestone Sep 12, 2024
@Frapschen Frapschen deleted the fix-metadatagen-validate branch September 27, 2024 02:26
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.

[mdatagen] validateAttributes func should alos consider check attributes used in telemetry section
3 participants