opentelemetry-collector
opentelemetry-collector copied to clipboard
[mdatagen] Add optional display_name field to metadata.yaml
trafficstars
Description
This PR adds an optional display_name field to metadata.yaml for human-readable component names, as requested in #14114.
Changes
- Added
display_namefield to metadata-schema.yaml - Updated Metadata struct to include DisplayName field
- Implemented automatic capitalization of type field when display_name not provided
- Modified readme.md.tmpl to generate README titles from display_name
- Fixed unused import issue in config_test.go.tmpl
- Added test cases for display_name handling
- Regenerated internal test code and README files
Implementation
Following the implementation guide from @mx-psi:
- Added the field to the Metadata struct
- Added title generation section to readme.md.tmpl template
- Added comprehensive tests covering both explicit and default display names
- Verified functionality with OTLP receiver (tested locally)
Behavior
- When
display_nameis set in metadata.yaml, it will be used as the README title - When not set, the component type will be automatically capitalized (e.g., "otlp" becomes "Otlp")
- Fully backward compatible - existing components without display_name continue to work
Testing
- Unit tests added for display_name loading
- Default value generation tested
- Generated test files verified
- CI checks passing (gotidy, misspell, multimod-verify, crosslink)
Fixes #14114
Co-authored-by: SteveYi [email protected]
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 92.21%. Comparing base (a9691ee) to head (739ab2e).
:warning: Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #14115 +/- ##
==========================================
- Coverage 92.24% 92.21% -0.04%
==========================================
Files 658 658
Lines 41168 41168
==========================================
- Hits 37977 37963 -14
- Misses 2184 2193 +9
- Partials 1007 1012 +5
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.