mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 10:53:50 +08:00
Tracing: chore make insecure option configurable (#99236)
* Tracing: chore: make insecure option configurable In case of insecure set to false, default system cert pool will be used to create otlpgrpc client. * test: add tracing/insecure config checks This is to verify whether insecure configuration is properly parsed. * chore: update configura Grafana docs with new setting * chore: also update comment in the ini files --------- Co-authored-by: Matheus Macabu <macabu.matheus@gmail.com>
This commit is contained in:
@ -25,6 +25,7 @@ import (
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||
trace "go.opentelemetry.io/otel/trace"
|
||||
"go.opentelemetry.io/otel/trace/noop"
|
||||
"google.golang.org/grpc/credentials"
|
||||
|
||||
"github.com/go-kit/log/level"
|
||||
|
||||
@ -167,7 +168,14 @@ func (ots *TracingService) initJaegerTracerProvider() (*tracesdk.TracerProvider,
|
||||
}
|
||||
|
||||
func (ots *TracingService) initOTLPTracerProvider() (*tracesdk.TracerProvider, error) {
|
||||
client := otlptracegrpc.NewClient(otlptracegrpc.WithEndpoint(ots.cfg.Address), otlptracegrpc.WithInsecure())
|
||||
opts := []otlptracegrpc.Option{otlptracegrpc.WithEndpoint(ots.cfg.Address)}
|
||||
if ots.cfg.Insecure {
|
||||
opts = append(opts, otlptracegrpc.WithInsecure())
|
||||
} else {
|
||||
opts = append(opts, otlptracegrpc.WithTLSCredentials(credentials.NewTLS(nil)))
|
||||
}
|
||||
|
||||
client := otlptracegrpc.NewClient(opts...)
|
||||
exp, err := otlptrace.New(context.Background(), client)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user