-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Component(s)
config/configgrpc
Is your feature request related to a problem? Please describe.
The intent is to be able to add custom grpc.DialOption to the connection used by the OTLP exporter. This should be extended to grpc Server and ideally to http as well.
Describe the solution you'd like
Add an API to configgrpc.ClientConfig that allows to add ToClientConnOption and stores them until ToClientConn. Then when ToClientConn is called (that also has allows passing options) use both the stored and the passed options.
This is how we will override the CreateLogs (as an example) to pass our custom TLS:
type factory struct {
receiver.Factory
}
func (dlf *factory) CreateLogs(ctx context.Context, set exporter.Settings, cfg component.Config) (receiver.Metrics, error) {
otlpCfg := cfg.(otlpexporter.Config)
// To ignore TLS config. We can also return error if set.
otlpCfg.ClientConfig.TLS = cofigtls.ClientConfig{Insecure: true}
otlpCfg.AddClientConnOption(configgrpc.WithGrpcDialOption(snowtls.NewDialOption()))
return dlf.Factory.CreateLogs(ctx, set, otlpCfg)
}
// NewFactory creates a factory for otlp exporter.
func NewFactory() receiver.Factory {
return &factory{Factory: otlpexporter.NewFactory()}
}
Unfortunately it is not possible to use the current ToClientConn (work added in #11069) because that is called internally by the otlp exporter and cannot be changed from outside.
Describe alternatives you've considered
Create this extension on every component that uses configgrpc.ClientConfig and use the already existing API ToClientConn() to pass the options. The main downside is that this needs to be implemented for all the components that uses the configgrpc.ClientConfig.
Additional context
We are obtaining the TLS configuration using a different mechanism than a file.
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.