util/otelutil: change uses of deprecated instrumentation.Library

While the interface's signature uses the deprecated "Library" type,
and upstream documents it as "needed for backward compatibility";
https://github.com/open-telemetry/opentelemetry-go/blob/0f7f1d0bad21aba18feaadc0171c53705fbda419/sdk/trace/span.go#L62-L65

The Library type is now an alias for Scope, so using the non-deprecated
type still satisfies the interface;
https://github.com/open-telemetry/opentelemetry-go/blob/0f7f1d0bad21aba18feaadc0171c53705fbda419/sdk/instrumentation/library.go#L6-L9

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-07-03 13:40:29 +02:00
parent fd87647da1
commit 1205802f63
+4 -7
View File
@@ -59,8 +59,7 @@ type Span struct {
Resource []attribute.KeyValue
// InstrumentationLibrary is information about the library that produced
// the span
//nolint:staticcheck
InstrumentationLibrary instrumentation.Library
InstrumentationLibrary instrumentation.Scope
}
type Spans []Span
@@ -112,8 +111,8 @@ type spanData struct {
DroppedLinks int
ChildSpanCount int
Resource []keyValue // change this type from the otel type to make this struct marshallable
//nolint:staticcheck
InstrumentationLibrary instrumentation.Library
InstrumentationLibrary instrumentation.Scope
}
// spanContext is a custom type used to unmarshal otel SpanContext correctly.
@@ -484,8 +483,6 @@ func (s spanSnapshot) InstrumentationScope() instrumentation.Scope {
}
// InstrumentationLibrary returns the InstrumentationLibrary of the snapshot
//
//nolint:staticcheck
func (s spanSnapshot) InstrumentationLibrary() instrumentation.Library {
func (s spanSnapshot) InstrumentationLibrary() instrumentation.Scope {
return s.instrumentationScope
}