-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
mdatagen: support custom package name #11232
mdatagen: support custom package name #11232
Conversation
Adds support for a new `--package_name` flag to allow mdatagen to generate packages with names other than `metadata`.
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.
Overall this looks pretty good, just a couple of comments, it looks like make gofmt
needs to be run to sort out the import statements. Also please add a note in the schema file: https://github.com/open-telemetry/opentelemetry-collector/blob/main/cmd/mdatagen/metadata-schema.yaml
cmd/mdatagen/internal/samplereceiver/generated_component_test.go
Outdated
Show resolved
Hide resolved
cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_config_test.go
Outdated
Show resolved
Hide resolved
cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_metrics_test.go
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11232 +/- ##
=======================================
Coverage 92.15% 92.15%
=======================================
Files 432 432
Lines 20291 20293 +2
=======================================
+ Hits 18700 18702 +2
Misses 1228 1228
Partials 363 363 ☔ View full report in Codecov by Sentry. |
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.
Thanks for the update @braydonk, looks good now, can merge it once the conflict has been resolved
I noticed a mistake in my previous PR open-telemetry#11232; some function calls did not pass the correct package name in (passing in "metadata" instead of the intended generated package name). This PR attempts to address the potential for this mistake to even occur by providing a wrapper `generateFile` function that automatically uses the generated package name from the metadata. The original version of the function that accepts a package name is intact for the templates that are going in the base package instead of the generated one.
I noticed a mistake in my previous PR open-telemetry#11232; some function calls did not pass the correct package name in (passing in "metadata" instead of the intended generated package name). This PR attempts to address the potential for this mistake to even occur by providing a wrapper `generateFile` function that automatically uses the generated package name from the metadata. The original version of the function that accepts a package name is intact for the templates that are going in the base package instead of the generated one.
#### Description This PR adds support for a new ~~`--package_name` flag~~ `generated_package_name` config field to allow mdatagen to generate packages with names other than `metadata`. #### Link to tracking issue Fixes open-telemetry#11231 #### Testing * Unit tests * `go install`ing this branch and using it in a test scenario with two yaml files and generating two packages. #### Documentation
Description
This PR adds support for a new
--package_name
flaggenerated_package_name
config field to allow mdatagen to generate packages with names other thanmetadata
.Link to tracking issue
Fixes #11231
Testing
go install
ing this branch and using it in a test scenario with two yaml files and generating two packages.Documentation