mirror of
https://github.com/prometheus/prometheus
synced 2026-04-20 22:41:05 +08:00
tracing: fix startup failure for insecure OTLP HTTP tracing
Signed-off-by: Jeon Insoo <mumberrymountain@gmail.com>
This commit is contained in:
committed by
Julien Pivotto
parent
d7cd96cb98
commit
b997a29e24
@@ -207,6 +207,14 @@ func getClient(tracingCfg config.TracingConfig) (otlptrace.Client, error) {
|
||||
opts := []otlptracehttp.Option{otlptracehttp.WithEndpoint(tracingCfg.Endpoint)}
|
||||
if tracingCfg.Insecure {
|
||||
opts = append(opts, otlptracehttp.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, otlptracehttp.WithTLSClientConfig(tlsConf))
|
||||
}
|
||||
// Currently, OTEL supports only gzip compression.
|
||||
if tracingCfg.Compression == config.GzipCompression {
|
||||
@@ -219,12 +227,6 @@ func getClient(tracingCfg config.TracingConfig) (otlptrace.Client, error) {
|
||||
opts = append(opts, otlptracehttp.WithTimeout(time.Duration(tracingCfg.Timeout)))
|
||||
}
|
||||
|
||||
tlsConf, err := config_util.NewTLSConfig(&tracingCfg.TLSConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
opts = append(opts, otlptracehttp.WithTLSClientConfig(tlsConf))
|
||||
|
||||
client = otlptracehttp.NewClient(opts...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user