Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions tracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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...)
}

Expand Down
12 changes: 12 additions & 0 deletions tracing/tracing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ func TestUninstallingTracerProvider(t *testing.T) {
require.Equal(t, noop.NewTracerProvider(), otel.GetTracerProvider())
}

func TestInstallingTracerProviderHTTPInsecure(t *testing.T) {
m := NewManager(promslog.NewNopLogger())
cfg := config.Config{
TracingConfig: config.TracingConfig{
Endpoint: "localhost:4318",
ClientType: config.TracingClientHTTP,
Insecure: true,
},
}
require.NoError(t, m.ApplyConfig(&cfg))
}

func TestTracerProviderShutdown(t *testing.T) {
m := NewManager(promslog.NewNopLogger())
cfg := config.Config{
Expand Down
Loading