-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Generate assert function for each metric in mdatagen #12179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate assert function for each metric in mdatagen #12179
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12179 +/- ##
==========================================
+ Coverage 91.62% 91.80% +0.18%
==========================================
Files 465 465
Lines 24775 25342 +567
==========================================
+ Hits 22699 23266 +567
Misses 1687 1687
Partials 389 389 ☔ View full report in Codecov by Sentry. |
metricdatatest.AssertEqual(t, want, got, opts...) | ||
} | ||
|
||
// ensure no additional metrics are emitted | ||
require.Equal(t, len(expected), lenMetrics(md)) | ||
} | ||
|
||
func getMetric(name string, got metricdata.ResourceMetrics) metricdata.Metrics { | ||
{{ range $name, $metric := .Telemetry.Metrics }} | ||
{{ if not $metric.Optional }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we generate for this as well?
FYI: I've never seen a usage of this optional. Can we check if used, otherwise to remove it?
…#12184) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description A follow-up PR of #12179 , cc @bogdandrutu Note: This PR also removes those metric assertions which is actually testing metrics that doesn't belong to the package. They might be added due to the limitation of the AssertMetrics function. e.g. changes in `processor/memorylimitprocessor/memorylimiter_test.go` <!-- Issue number if applicable --> #### Link to tracking issue Relevant to #12179 <!--Describe what testing was performed and which tests were added.--> #### Testing Updated <!--Describe the documentation added.--> #### Documentation n/a <!--Please delete paragraphs that you did not use before submitting.-->
…12179) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Completion of open-telemetry#12167 , cc @bogdandrutu Updated one test to verify the change, will update the rest ones after this PR merges. <!-- Issue number if applicable --> #### Link to tracking issue n/a <!--Describe what testing was performed and which tests were added.--> #### Testing Added <!--Describe the documentation added.--> #### Documentation Added <!--Please delete paragraphs that you did not use before submitting.-->
…open-telemetry#12184) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description A follow-up PR of open-telemetry#12179 , cc @bogdandrutu Note: This PR also removes those metric assertions which is actually testing metrics that doesn't belong to the package. They might be added due to the limitation of the AssertMetrics function. e.g. changes in `processor/memorylimitprocessor/memorylimiter_test.go` <!-- Issue number if applicable --> #### Link to tracking issue Relevant to open-telemetry#12179 <!--Describe what testing was performed and which tests were added.--> #### Testing Updated <!--Describe the documentation added.--> #### Documentation n/a <!--Please delete paragraphs that you did not use before submitting.-->
Description
Completion of #12167 , cc @bogdandrutu
Updated one test to verify the change, will update the rest ones after this PR merges.
Link to tracking issue
n/a
Testing
Added
Documentation
Added