Skip to content

Featuregates don't work until late in initialization #4967

Closed
@aabmass

Description

Describe the bug

The --feature-gates CLI flag is not applied until this line:

if err := cmd.Execute(); err != nil {

As a result any featuregate.IsEnabled(myFeatureGateID) checks during component factory creation (L16 in the same file) will return the default value regardless of the CLI flag. This also effects the contrib repo, for example in the googlecloud exporter this check always returns false.

Steps to reproduce

Perform a featuregate.IsEnabled() check in a NewFactory() method, for example here

return component.NewExporterFactory(

What did you expect to see?
featuregate checks should work early during factory creation. They may be used to enable/disable features early on during initialization. They shouldn't have different result depending on the time they are called.

What did you see instead?
the --feature-gates CLI flag has no effect if checked during factory creation.

What version did you use?
main

What config did you use?
N/A

Environment
Linux/go1.18

cc @dashpole

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions