Skip to content

[cmd/mdatagen] Add go_name support to go_struct config in metadata.yaml#15486

Merged
dmitryax merged 9 commits into
open-telemetry:mainfrom
jkoronaAtCisco:custom_go_name
Jun 26, 2026
Merged

[cmd/mdatagen] Add go_name support to go_struct config in metadata.yaml#15486
dmitryax merged 9 commits into
open-telemetry:mainfrom
jkoronaAtCisco:custom_go_name

Conversation

@jkoronaAtCisco

@jkoronaAtCisco jkoronaAtCisco commented Jun 23, 2026

Copy link
Copy Markdown
Member

Description

This change introduces explicit go_name field under go_struct in metadata.yaml. Component authors can now set any custom Go field name for a config property:

  component:
    type: string
    x-customType: go.opentelemetry.io/collector/component.ID
    go_struct:
      go_name: ComponentID

This generates ComponentID component.ID in the config struct while keeping mapstructure:"component" for YAML unmarshaling. If go_name is omitted, the property name is used as-is .

Testing

  1. The sample scraper's metadata.yaml is updated to demonstrate the feature.
  2. Added unit tests

Authorship

  • I, a human, wrote this pull request description myself.

@jkoronaAtCisco
jkoronaAtCisco requested review from a team and dmitryax as code owners June 23, 2026 12:22
Added an issue reference to the enhancement note.
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.08%. Comparing base (9782f9e) to head (a9cde83).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15486   +/-   ##
=======================================
  Coverage   91.08%   91.08%           
=======================================
  Files         726      726           
  Lines       47929    47937    +8     
=======================================
+ Hits        43656    43664    +8     
  Misses       2978     2978           
  Partials     1295     1295           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread cmd/mdatagen/internal/samplescraper/metadata.yaml Outdated
@codspeed-hq

codspeed-hq Bot commented Jun 24, 2026

Copy link
Copy Markdown

Merging this PR will create unknown performance changes

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⏩ 4 skipped benchmarks1
🗄️ 4 archived benchmarks run2


Comparing jkoronaAtCisco:custom_go_name (a9cde83) with main (9782f9e)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. 4 benchmarks were run, but are now archived. If they were deleted in another branch, consider rebasing to remove them from the report. Instead if they were added back, click here to restore them.

Comment thread cmd/mdatagen/internal/templates/config_from_cfggen.go.tmpl Outdated
@dmitryax
dmitryax added this pull request to the merge queue Jun 26, 2026
@dmitryax
dmitryax removed this pull request from the merge queue due to a manual request Jun 26, 2026
Comment thread .chloggen/custom_go_name.yaml Outdated
@dmitryax
dmitryax enabled auto-merge June 26, 2026 16:42
@dmitryax
dmitryax added this pull request to the merge queue Jun 26, 2026
Merged via the queue into open-telemetry:main with commit 5244834 Jun 26, 2026
68 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants