opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

[mdatagen] Add optional display_name field to metadata.yaml

Open thc1006 opened this issue 2 weeks ago • 1 comments
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_name field 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:

  1. Added the field to the Metadata struct
  2. Added title generation section to readme.md.tmpl template
  3. Added comprehensive tests covering both explicit and default display names
  4. Verified functionality with OTLP receiver (tested locally)

Behavior

  • When display_name is 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]

thc1006 avatar Nov 03 '25 16:11 thc1006

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.

codecov[bot] avatar Nov 03 '25 16:11 codecov[bot]