mirror of
https://github.com/prometheus/prometheus
synced 2024-12-24 23:42:32 +00:00
Tracing/GRPC: Set TLS credentials only when insecure is false.
Fixes #10542 Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
This commit is contained in:
parent
db8c550570
commit
b4d0dcb6e8
@ -183,6 +183,14 @@ func getClient(tracingCfg config.TracingConfig) (otlptrace.Client, error) {
|
||||
opts := []otlptracegrpc.Option{otlptracegrpc.WithEndpoint(tracingCfg.Endpoint)}
|
||||
if tracingCfg.Insecure {
|
||||
opts = append(opts, otlptracegrpc.WithInsecure())
|
||||
} else {
|
||||
// Use of TLS Credentials forces the use of TLS. Therefore it can
|
||||
// only be set when `insecure` is set to false.
|
||||
tlsConf, err := config_util.NewTLSConfig(&tracingCfg.TLSConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
opts = append(opts, otlptracegrpc.WithTLSCredentials(credentials.NewTLS(tlsConf)))
|
||||
}
|
||||
if tracingCfg.Compression != "" {
|
||||
opts = append(opts, otlptracegrpc.WithCompressor(tracingCfg.Compression))
|
||||
@ -194,12 +202,6 @@ func getClient(tracingCfg config.TracingConfig) (otlptrace.Client, error) {
|
||||
opts = append(opts, otlptracegrpc.WithTimeout(time.Duration(tracingCfg.Timeout)))
|
||||
}
|
||||
|
||||
tlsConf, err := config_util.NewTLSConfig(&tracingCfg.TLSConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
opts = append(opts, otlptracegrpc.WithTLSCredentials(credentials.NewTLS(tlsConf)))
|
||||
|
||||
client = otlptracegrpc.NewClient(opts...)
|
||||
case config.TracingClientHTTP:
|
||||
opts := []otlptracehttp.Option{otlptracehttp.WithEndpoint(tracingCfg.Endpoint)}
|
||||
|
Loading…
Reference in New Issue
Block a user