Skip to content

Commit

Permalink
fix remaining deprecation lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dmathieu committed Jul 17, 2024
1 parent 7b47d8b commit 5283c7b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
4 changes: 2 additions & 2 deletions bridge/opencensus/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ func TestNewTraceBridge(t *testing.T) {
gotSpans := exporter.GetSpans()
require.Len(t, gotSpans, 1)
gotSpan := gotSpans[0]
assert.Equal(t, gotSpan.InstrumentationLibrary.Name, scopeName)
assert.Equal(t, gotSpan.InstrumentationLibrary.Version, Version())
assert.Equal(t, gotSpan.InstrumentationScope.Name, scopeName)
assert.Equal(t, gotSpan.InstrumentationScope.Version, Version())
}
4 changes: 2 additions & 2 deletions exporters/otlp/otlptrace/internal/tracetransform/span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ func TestSpanData(t *testing.T) {
assert.Equal(t, got[0].SchemaUrl, spanData.Resource.SchemaURL())
scopeSpans := got[0].GetScopeSpans()
require.Len(t, scopeSpans, 1)
assert.Equal(t, scopeSpans[0].SchemaUrl, spanData.InstrumentationLibrary.SchemaURL)
assert.Equal(t, scopeSpans[0].GetScope(), InstrumentationScope(spanData.InstrumentationLibrary))
assert.Equal(t, scopeSpans[0].SchemaUrl, spanData.InstrumentationScope.SchemaURL)
assert.Equal(t, scopeSpans[0].GetScope(), InstrumentationScope(spanData.InstrumentationScope))
require.Len(t, scopeSpans[0].Spans, 1)
actualSpan := scopeSpans[0].Spans[0]

Expand Down
2 changes: 1 addition & 1 deletion sdk/trace/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (s snapshot) InstrumentationScope() instrumentation.Scope {

// InstrumentationLibrary returns information about the instrumentation
// library that created the span.
func (s snapshot) InstrumentationLibrary() instrumentation.Library {
func (s snapshot) InstrumentationLibrary() instrumentation.Library { //nolint:staticcheck // This method needs to be define for backwards compatibility
return s.instrumentationScope
}

Expand Down
4 changes: 2 additions & 2 deletions sdk/trace/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type ReadOnlySpan interface {
// InstrumentationLibrary returns information about the instrumentation
// library that created the span.
// Deprecated: please use InstrumentationScope instead.
InstrumentationLibrary() instrumentation.Library
InstrumentationLibrary() instrumentation.Library //nolint:staticcheck // This method needs to be define for backwards compatibility
// Resource returns information about the entity that produced the span.
Resource() *resource.Resource
// DroppedAttributes returns the number of attributes dropped by the span
Expand Down Expand Up @@ -642,7 +642,7 @@ func (s *recordingSpan) InstrumentationScope() instrumentation.Scope {

// InstrumentationLibrary returns the instrumentation.Library associated with
// the Tracer that created this span.
func (s *recordingSpan) InstrumentationLibrary() instrumentation.Library {
func (s *recordingSpan) InstrumentationLibrary() instrumentation.Library { //nolint:staticcheck // This method needs to be define for backwards compatibility
s.mu.Lock()
defer s.mu.Unlock()
return s.tracer.instrumentationScope
Expand Down
38 changes: 20 additions & 18 deletions sdk/trace/tracetest/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,25 @@ func (s SpanStubs) Snapshots() []tracesdk.ReadOnlySpan {

// SpanStub is a stand-in for a Span.
type SpanStub struct {
Name string
SpanContext trace.SpanContext
Parent trace.SpanContext
SpanKind trace.SpanKind
StartTime time.Time
EndTime time.Time
Attributes []attribute.KeyValue
Events []tracesdk.Event
Links []tracesdk.Link
Status tracesdk.Status
DroppedAttributes int
DroppedEvents int
DroppedLinks int
ChildSpanCount int
Resource *resource.Resource
InstrumentationScope instrumentation.Scope
InstrumentationLibrary instrumentation.Library // Deprecated: use InstrumentationScope instead.
Name string
SpanContext trace.SpanContext
Parent trace.SpanContext
SpanKind trace.SpanKind
StartTime time.Time
EndTime time.Time
Attributes []attribute.KeyValue
Events []tracesdk.Event
Links []tracesdk.Link
Status tracesdk.Status
DroppedAttributes int
DroppedEvents int
DroppedLinks int
ChildSpanCount int
Resource *resource.Resource
InstrumentationScope instrumentation.Scope

// Deprecated: use InstrumentationScope instead.
InstrumentationLibrary instrumentation.Library //nolint:staticcheck // This method needs to be define for backwards compatibility
}

// SpanStubFromReadOnlySpan returns a SpanStub populated from ro.
Expand Down Expand Up @@ -159,6 +161,6 @@ func (s spanSnapshot) InstrumentationScope() instrumentation.Scope {
return s.instrumentationScope
}

func (s spanSnapshot) InstrumentationLibrary() instrumentation.Library {
func (s spanSnapshot) InstrumentationLibrary() instrumentation.Library { //nolint:staticcheck // This method needs to be define for backwards compatibility
return s.instrumentationScope
}

0 comments on commit 5283c7b

Please sign in to comment.