From 030ba6922fca0676e89532ff871cdde2f0b6488b Mon Sep 17 00:00:00 2001 From: Christina Troger Date: Mon, 14 Mar 2022 20:34:44 +0100 Subject: [PATCH] Use resource.New This function enables OTEL to scan for env variables and merge them with command line arguments --- cobrautil.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cobrautil.go b/cobrautil.go index 8648051..5c72cb1 100644 --- a/cobrautil.go +++ b/cobrautil.go @@ -232,10 +232,7 @@ func OpenTelemetryRunE(flagPrefix string, prerunLevel zerolog.Level) CobraRunFun } func initOtelTracer(exporter trace.SpanExporter, serviceName string, propagators []string) error { - res, _ := resource.Merge( - resource.Default(), - resource.NewSchemaless(semconv.ServiceNameKey.String(serviceName)), - ) + res, _ := resource.New(context.Background(), resource.WithAttributes(semconv.ServiceNameKey.String(serviceName))) tp := trace.NewTracerProvider( trace.WithSampler(trace.AlwaysSample()),