Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Added

- Add macOS ARM64 platform to the compatibility testing suite. (#5577)
- The `InstrumentationScope` attribute to `SpanStub` in `go.opentelemetry.io/otel/sdk/trace/tracetest`, as a replacement for the deprecated `InstrumentationLibrary`. (#5627)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func SingleReadOnlySpan() []tracesdk.ReadOnlySpan {
DroppedLinks: 0,
ChildSpanCount: 0,
Resource: resource.NewSchemaless(attribute.String("a", "b")),
InstrumentationLibrary: instrumentation.Library{
InstrumentationScope: instrumentation.Scope{
Name: "bar",
Version: "0.0.0",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func SingleReadOnlySpan() []tracesdk.ReadOnlySpan {
DroppedLinks: 0,
ChildSpanCount: 0,
Resource: resource.NewSchemaless(attribute.String("a", "b")),
InstrumentationLibrary: instrumentation.Library{
InstrumentationScope: instrumentation.Scope{
Name: "bar",
Version: "0.0.0",
},
Expand Down
5 changes: 5 additions & 0 deletions exporters/stdout/stdouttrace/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ func expectedJSON(now time.Time) string {
}
}
],
"InstrumentationScope": {
"Name": "",
"Version": "",
"SchemaURL": ""
},
"InstrumentationLibrary": {
"Name": "",
"Version": "",
Expand Down
6 changes: 3 additions & 3 deletions exporters/zipkin/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,15 +1015,15 @@ func TestTagsTransformation(t *testing.T) {
{
name: "instrLib-empty",
data: tracetest.SpanStub{
InstrumentationLibrary: instrumentation.Library{},
InstrumentationScope: instrumentation.Scope{},
},
want: nil,
},
{
name: "instrLib-noversion",
data: tracetest.SpanStub{
Attributes: []attribute.KeyValue{},
InstrumentationLibrary: instrumentation.Library{
InstrumentationScope: instrumentation.Scope{
Name: instrLibName,
},
},
Expand All @@ -1035,7 +1035,7 @@ func TestTagsTransformation(t *testing.T) {
name: "instrLib-with-version",
data: tracetest.SpanStub{
Attributes: []attribute.KeyValue{},
InstrumentationLibrary: instrumentation.Library{
InstrumentationScope: instrumentation.Scope{
Name: instrLibName,
Version: instrLibVersion,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func SingleReadOnlySpan() []tracesdk.ReadOnlySpan {
DroppedLinks: 0,
ChildSpanCount: 0,
Resource: resource.NewSchemaless(attribute.String("a", "b")),
InstrumentationLibrary: instrumentation.Library{
InstrumentationScope: instrumentation.Scope{
Name: "bar",
Version: "0.0.0",
},
Expand Down
9 changes: 8 additions & 1 deletion sdk/trace/tracetest/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type SpanStub struct {
DroppedLinks int
ChildSpanCount int
Resource *resource.Resource
InstrumentationScope instrumentation.Scope
InstrumentationLibrary instrumentation.Library
}

Expand All @@ -85,12 +86,18 @@ func SpanStubFromReadOnlySpan(ro tracesdk.ReadOnlySpan) SpanStub {
DroppedLinks: ro.DroppedLinks(),
ChildSpanCount: ro.ChildSpanCount(),
Resource: ro.Resource(),
InstrumentationScope: ro.InstrumentationScope(),
InstrumentationLibrary: ro.InstrumentationScope(),
}
}

// Snapshot returns a read-only copy of the SpanStub.
func (s SpanStub) Snapshot() tracesdk.ReadOnlySpan {
scopeOrLibrary := s.InstrumentationScope
if scopeOrLibrary.Name == "" && scopeOrLibrary.Version == "" && scopeOrLibrary.SchemaURL == "" {
scopeOrLibrary = s.InstrumentationLibrary
}

return spanSnapshot{
name: s.Name,
spanContext: s.SpanContext,
Expand All @@ -107,7 +114,7 @@ func (s SpanStub) Snapshot() tracesdk.ReadOnlySpan {
droppedLinks: s.DroppedLinks,
childSpanCount: s.ChildSpanCount,
resource: s.Resource,
instrumentationScope: s.InstrumentationLibrary,
instrumentationScope: scopeOrLibrary,
}
}

Expand Down