Skip to content

[chore] processor/metricsgenerationprocessor: migrate feature gate to mdatagen#47512

Merged
mx-psi merged 5 commits into
open-telemetry:mainfrom
ogulcanaydogan:refactor/46116-migrate-featuregate-metricsgenerationprocessor
Apr 10, 2026
Merged

[chore] processor/metricsgenerationprocessor: migrate feature gate to mdatagen#47512
mx-psi merged 5 commits into
open-telemetry:mainfrom
ogulcanaydogan:refactor/46116-migrate-featuregate-metricsgenerationprocessor

Conversation

@ogulcanaydogan

Copy link
Copy Markdown
Contributor

This PR migrates the metricsgeneration.MatchAttributes feature gate in processor/metricsgenerationprocessor from manual featuregate.GlobalRegistry().MustRegister() to metadata.yaml for mdatagen code generation, as part of #46116.

Changes:

  • Added feature_gates: section to metadata.yaml
  • Ran go generate ./... to produce internal/metadata/generated_feature_gates.go and update documentation.md
  • Removed the manual MustRegister block from processor.go; updated the call site to use metadata.MetricsgenerationMatchAttributesFeatureGate
  • Updated processor_test.go to reference the generated gate variable
  • Removed the forbidigo lint exclusion for this package from .golangci.yml

Testing:

go build ./...  # passes
go test ./...   # ok github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor

@ogulcanaydogan ogulcanaydogan requested review from a team and crobert-1 as code owners April 9, 2026 21:32
@github-actions github-actions Bot added the processor/metricsgeneration Metrics Generation processor label Apr 9, 2026
@github-actions github-actions Bot requested a review from Aneurysm9 April 9, 2026 21:32
@jijo-OO7

Copy link
Copy Markdown
Contributor

Thanks ! for working on this a few cl checks are currently failing
can you fix those as well

  • Add chore : [chore] processor/metricsgenerationprocessor: migrate feature gate to mdatagen to skip change log
  • run make gogci for import order formating
  • make sure all tests and CL check Pass

ogulcanaydogan added a commit to ogulcanaydogan/opentelemetry-collector-contrib that referenced this pull request Apr 10, 2026
Add .chloggen entry for PR open-telemetry#47512 and fix import ordering
in generated_package_test.go per make gogci.
@ogulcanaydogan

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback @jijo-OO7! I've pushed a follow-up commit that:

  • Adds .chloggen/47512.yaml changelog entry
  • Fixes import ordering via make gogci

Move metricsgeneration.MatchAttributes feature gate registration from
manual featuregate.GlobalRegistry().MustRegister() in processor.go to
the metadata.yaml file, letting mdatagen generate the registration code.

Remove the forbidigo lint exclusion for this package from .golangci.yml
since it no longer uses manual feature gate registration.

Fixes open-telemetry#46116
Add .chloggen entry for PR open-telemetry#47512 and fix import ordering
in generated_package_test.go per make gogci.
…runs

The package-level testCases slice holds pre-built pmetric.Metrics objects.
The processor appends new metrics in-place, so subsequent runs under -count=3
see a progressively growing inMetrics, causing expected:3 actual:5 failures.

Assisted-by: Claude Sonnet 4.6
pmetric.Metrics has no Clone method; use NewMetrics + CopyTo instead.

Assisted-by: Claude Sonnet 4.6
@ogulcanaydogan ogulcanaydogan force-pushed the refactor/46116-migrate-featuregate-metricsgenerationprocessor branch from eaaae3e to 4084a68 Compare April 10, 2026 08:31

@mx-psi mx-psi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one note about the changelog, otherwise looks good!

Comment thread .chloggen/47512.yaml Outdated

@mx-psi mx-psi Apr 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need a changelog entry for this, as @jijo-OO7 suggested, could you remove this and add "[chore]" at the start of your PR name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — removed the changelog file and updated the PR title to [chore].

@ogulcanaydogan ogulcanaydogan changed the title processor/metricsgenerationprocessor: migrate feature gate to mdatagen [chore] processor/metricsgenerationprocessor: migrate feature gate to mdatagen Apr 10, 2026
@mx-psi mx-psi added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Apr 10, 2026
@mx-psi mx-psi merged commit 208b7c0 into open-telemetry:main Apr 10, 2026
208 of 210 checks passed
@otelbot

otelbot Bot commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution @ogulcanaydogan! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. If you are getting started contributing, you can also join the CNCF Slack channel #opentelemetry-new-contributors to ask for guidance and get help.

ogulcanaydogan added a commit to ogulcanaydogan/opentelemetry-collector-contrib that referenced this pull request Apr 13, 2026
Add .chloggen entry for PR open-telemetry#47512 and fix import ordering
in generated_package_test.go per make gogci.
ogulcanaydogan added a commit to ogulcanaydogan/opentelemetry-collector-contrib that referenced this pull request Apr 13, 2026
Add .chloggen entry for PR open-telemetry#47512 and fix import ordering
in generated_package_test.go per make gogci.
ogulcanaydogan added a commit to ogulcanaydogan/opentelemetry-collector-contrib that referenced this pull request Apr 13, 2026
Add .chloggen entry for PR open-telemetry#47512 and fix import ordering
in generated_package_test.go per make gogci.
ogulcanaydogan added a commit to ogulcanaydogan/opentelemetry-collector-contrib that referenced this pull request Apr 15, 2026
Add .chloggen entry for PR open-telemetry#47512 and fix import ordering
in generated_package_test.go per make gogci.
AndrewCharlesHay pushed a commit to AndrewCharlesHay/opentelemetry-collector-contrib that referenced this pull request Apr 23, 2026
… mdatagen (open-telemetry#47512)

This PR migrates the `metricsgeneration.MatchAttributes` feature gate in
`processor/metricsgenerationprocessor` from manual
`featuregate.GlobalRegistry().MustRegister()` to `metadata.yaml` for
mdatagen code generation, as part of open-telemetry#46116.

**Changes:**
- Added `feature_gates:` section to `metadata.yaml`
- Ran `go generate ./...` to produce
`internal/metadata/generated_feature_gates.go` and update
`documentation.md`
- Removed the manual `MustRegister` block from `processor.go`; updated
the call site to use
`metadata.MetricsgenerationMatchAttributesFeatureGate`
- Updated `processor_test.go` to reference the generated gate variable
- Removed the `forbidigo` lint exclusion for this package from
`.golangci.yml`

**Testing:**
```
go build ./...  # passes
go test ./...   # ok github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor
```
ogulcanaydogan added a commit to ogulcanaydogan/opentelemetry-collector-contrib that referenced this pull request Apr 24, 2026
Add .chloggen entry for PR open-telemetry#47512 and fix import ordering
in generated_package_test.go per make gogci.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

processor/metricsgeneration Metrics Generation processor Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants