Register featuregate, otherwise does not work#16269
Conversation
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
4769c48 to
b43b9c8
Compare
|
@Aneurysm9 @mx-psi @codeboten I expect that we enforce correct usages of the Update: may mean that the API is not well designed, but we need to investigate a bit this. |
We almost want A minor improvement could have There might be a solution that requires all feature gates to be resolved during collector startup. That way, we can panic/fail immediately without risk of rare circumstances. This probably means moving // component/processor.go
func WithFeatureGate(gateID string, callback(gateVal bool)) ProcessorFactoryOption {
return processorFactoryOptionFunc(func(o *processorFactory) {
enabled, err := featuregateinternal.GetRegistry().IsEnabled(gateID)
if err != nil {
o.unresolvedFeatureGateErr = err // fail gracefully later (or just panic now)
return
}
callback(enabled)
})
}
// processor/myprocessor
type Config struct {
myFeatureGate bool
}
func NewFactory() component.ProcessorFactory {
cfg := createDefaultConfig
return component.NewProcessorFactory(
typeStr,
cfg,
component.WithTracesProcessor(createTracesProcessor, component.StabilityLevelStable),
component.WithMetricsProcessor(createMetricsProcessor, component.StabilityLevelStable),
component.WithLogsProcessor(createLogsProcessor, component.StabilityLevelStable)),
component.WithFeatureGate("my.feature", func(gateVal bool) {
cfg.myFeatureGate = gateVal
})
} |
|
@djaglowski will post a PR with a proposal soon in core, I do have some ideas, and I like also what you suggested. |
|
I'd missed that the unit test was not using the featuregate to turn on/off This should probably be a requirement of adding featuregates, that they be used in the unit tests. |
* main: [chore] dependabot updates Tue Nov 15 00:17:56 UTC 2022 (open-telemetry#16300) [receiver/rabbitmq] Fix flaky integration test (open-telemetry#16240) [Docker Stats Receiver] Add @jamesmoessis as code owner (open-telemetry#16253) [receiver/mongodbatlas] Alerts poll mode check hostname and port (open-telemetry#16286) [chore] update jaeger dep (open-telemetry#16287) [pkg/stanza] Fix issue where specifying a non-existent storage extension caused panic during shutdown. (open-telemetry#16213) [pkg/ottl] Rename ottllogs to ottllog (open-telemetry#16242) Register featuregate, otherwise does not work (open-telemetry#16269) [receiver/elasticsearch]: add fielddata memory size metrics on index level (open-telemetry#14922) [chore] remove what looks to be debugging code from instanaexporter (open-telemetry#16258)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com> Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com> Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
No description provided.