Skip to content

[mdatagen] missing imports after running make generate #13069

@kaiyan-sheng

Description

@kaiyan-sheng

Component(s)

cmd/mdatagen

What happened?

Describe the bug
When a new metric is added into metadata.yaml file and make generate is ran, I can see multiple files generated by mdatagen. But one of the files internal/metadataset/generated_telemetrytest_test.go is missing an import:
Image

Steps to reproduce

  1. add a metric in metadata.yaml
  2. run make generate
  3. you can check Use mdatagen to add a telemetry metric kaiyan-sheng/opentelemetry-collector-components#1 as an example for the missing import

The workaround is to run goimports after the make generate command. But it would be nice to have mdatagen to take care of the imports directly.

What did you expect to see?
I expect to see "github.com/elastic/opentelemetry-collector-components/processor/ratelimitprocessor/internal/metadata" in the import list.

What did you see instead?
Missing import instead.

Collector version

v0.125.0

Environment information

Environment

OS: macOS 15.4.1
Compiler(if manually compiled): go 1.23.8

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions