-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Switch service feature gates to be auto generated #14494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,49 +8,37 @@ import ( | |
| "fmt" | ||
|
|
||
| "go.opentelemetry.io/collector/component" | ||
| "go.opentelemetry.io/collector/featuregate" | ||
| "go.opentelemetry.io/collector/pipeline" | ||
| "go.opentelemetry.io/collector/pipeline/xpipeline" | ||
| "go.opentelemetry.io/collector/service/internal/metadata" | ||
| ) | ||
|
|
||
| var ( | ||
| errMissingServicePipelines = errors.New("service must have at least one pipeline") | ||
| errMissingServicePipelineReceivers = errors.New("must have at least one receiver") | ||
| errMissingServicePipelineExporters = errors.New("must have at least one exporter") | ||
|
|
||
| serviceProfileSupportGateID = "service.profilesSupport" | ||
| serviceProfileSupportGate = featuregate.GlobalRegistry().MustRegister( | ||
| serviceProfileSupportGateID, | ||
| featuregate.StageAlpha, | ||
| featuregate.WithRegisterFromVersion("v0.112.0"), | ||
| featuregate.WithRegisterDescription("Controls whether profiles support can be enabled"), | ||
| ) | ||
| AllowNoPipelines = featuregate.GlobalRegistry().MustRegister( | ||
| "service.AllowNoPipelines", | ||
| featuregate.StageAlpha, | ||
| featuregate.WithRegisterFromVersion("v0.122.0"), | ||
| featuregate.WithRegisterDescription("Allow starting the Collector without starting any pipelines."), | ||
| ) | ||
| AllowNoPipelines = metadata.ServiceAllowNoPipelinesFeatureGate | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO it would be nice not to make this public. But we use it in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed it would be nice to have it private, but unfortunately the otelcol/service responsibility distinction can be a little fuzzy. It was already public before this PR, so it's fine to leave it for now.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One thing I've been pondering is whether it would make more sense to have 2 feature gates with the same name. |
||
| ) | ||
|
|
||
| // Config defines the configurable settings for service telemetry. | ||
| type Config map[pipeline.ID]*PipelineConfig | ||
|
|
||
| func (cfg Config) Validate() error { | ||
| // Must have at least one pipeline unless explicitly disabled. | ||
| if !AllowNoPipelines.IsEnabled() && len(cfg) == 0 { | ||
| if !metadata.ServiceAllowNoPipelinesFeatureGate.IsEnabled() && len(cfg) == 0 { | ||
| return errMissingServicePipelines | ||
| } | ||
|
|
||
| if !serviceProfileSupportGate.IsEnabled() { | ||
| if !metadata.ServiceProfilesSupportFeatureGate.IsEnabled() { | ||
| // Check that all pipelines have at least one receiver and one exporter, and they reference | ||
| // only configured components. | ||
| for pipelineID := range cfg { | ||
| if pipelineID.Signal() == xpipeline.SignalProfiles { | ||
| return fmt.Errorf( | ||
| "pipeline %q: profiling signal support is at alpha level, gated under the %q feature gate", | ||
| pipelineID.String(), | ||
| serviceProfileSupportGateID, | ||
| metadata.ServiceProfilesSupportFeatureGate.ID(), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.