diff --git a/util/tracing/transform/instrumentation.go b/util/tracing/transform/instrumentation.go deleted file mode 100644 index 216a364c63962..0000000000000 --- a/util/tracing/transform/instrumentation.go +++ /dev/null @@ -1,17 +0,0 @@ -package transform - -import ( - commonpb "go.opentelemetry.io/proto/otlp/common/v1" - - "go.opentelemetry.io/otel/sdk/instrumentation" -) - -func instrumentationLibrary(il *commonpb.InstrumentationLibrary) instrumentation.Library { - if il == nil { - return instrumentation.Library{} - } - return instrumentation.Library{ - Name: il.Name, - Version: il.Version, - } -} diff --git a/util/tracing/transform/span.go b/util/tracing/transform/span.go index f07d0c98e974c..d17c9353d37b6 100644 --- a/util/tracing/transform/span.go +++ b/util/tracing/transform/span.go @@ -5,7 +5,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/sdk/instrumentation" "go.opentelemetry.io/otel/sdk/resource" tracesdk "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/trace" @@ -18,30 +17,30 @@ const ( maxMessageEventsPerSpan = 128 ) -// Spans transforms slice of OTLP ResourceSpan into a slice of SpanSnapshots. -func Spans(sdl []*tracepb.ResourceSpans) []tracesdk.ReadOnlySpan { - if len(sdl) == 0 { +// Spans transforms slice of OTLP ResourceSpan into a slice of ReadOnlySpans. +func Spans(resourceSpans []*tracepb.ResourceSpans) []tracesdk.ReadOnlySpan { + if len(resourceSpans) == 0 { return nil } var out []tracesdk.ReadOnlySpan - for _, sd := range sdl { - if sd == nil { + for _, resourceSpan := range resourceSpans { + if resourceSpan == nil { continue } - for _, sdi := range sd.InstrumentationLibrarySpans { - sda := make([]tracesdk.ReadOnlySpan, len(sdi.Spans)) - for i, s := range sdi.Spans { - sda[i] = &readOnlySpan{ + for _, scopeSpan := range resourceSpan.ScopeSpans { + spans := make([]tracesdk.ReadOnlySpan, len(scopeSpan.Spans)) + for i, s := range scopeSpan.Spans { + spans[i] = &readOnlySpan{ pb: s, - il: sdi.InstrumentationLibrary, - resource: sd.Resource, - schemaURL: sd.SchemaUrl, + scope: scopeSpan.Scope, + resource: resourceSpan.Resource, + schemaURL: resourceSpan.SchemaUrl, } } - out = append(out, sda...) + out = append(out, spans...) } } @@ -53,7 +52,7 @@ type readOnlySpan struct { tracesdk.ReadOnlySpan pb *tracepb.Span - il *v11.InstrumentationLibrary + scope *v11.InstrumentationScope resource *v1.Resource schemaURL string } @@ -122,10 +121,6 @@ func (s *readOnlySpan) Status() tracesdk.Status { } } -func (s *readOnlySpan) InstrumentationLibrary() instrumentation.Library { - return instrumentationLibrary(s.il) -} - // Resource returns information about the entity that produced the span. func (s *readOnlySpan) Resource() *resource.Resource { if s.resource == nil {