@@ -19,7 +19,7 @@ import (
19
19
"go.opentelemetry.io/otel/propagation"
20
20
"go.opentelemetry.io/otel/sdk/resource"
21
21
sdktrace "go.opentelemetry.io/otel/sdk/trace"
22
- semconv "go.opentelemetry.io/otel/semconv/v1.12 .0"
22
+ semconv "go.opentelemetry.io/otel/semconv/v1.17 .0"
23
23
24
24
"github.com/cortexproject/cortex/pkg/tracing/migration"
25
25
"github.com/cortexproject/cortex/pkg/tracing/sampler"
@@ -119,7 +119,6 @@ func SetupTracing(ctx context.Context, name string, c Config) (func(context.Cont
119
119
}
120
120
121
121
r , err := newResource (ctx , name , c .Otel .ExtraDetectors )
122
-
123
122
if err != nil {
124
123
return nil , fmt .Errorf ("creating tracing resource: %w" , err )
125
124
}
@@ -158,14 +157,10 @@ func newTraceProvider(r *resource.Resource, c Config, exporter *otlptrace.Export
158
157
}
159
158
160
159
func newResource (ctx context.Context , target string , detectors []resource.Detector ) (* resource.Resource , error ) {
161
- r , err := resource .New ( ctx , resource . WithHost (), resource . WithDetectors ( detectors ... ))
162
-
163
- if err != nil {
164
- return nil , err
160
+ opts := [] resource.Option {
161
+ resource . WithHost (),
162
+ resource . WithDetectors ( detectors ... ),
163
+ resource . WithAttributes ( semconv . ServiceNameKey . String ( target )),
165
164
}
166
-
167
- return resource .Merge (r , resource .NewWithAttributes (
168
- semconv .SchemaURL ,
169
- semconv .ServiceNameKey .String (target ),
170
- ))
165
+ return resource .New (ctx , opts ... )
171
166
}
0 commit comments