Skip to content

Commit

Permalink
Unembed SpanContext (#1877)
Browse files Browse the repository at this point in the history
* Unembed SpanContext

rebase branch

* Update CHANGELOG
  • Loading branch information
IrisTuntun authored May 4, 2021
1 parent b7d02db commit 42a8450
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Renamed `CloudZoneKey` to `CloudAvailabilityZoneKey` in Resource semantic conventions according to spec. (#1871)
- The `StatusCode` and `StatusMessage` methods of the `ReadOnlySpan` interface and the `Span` produced by the `go.opentelemetry.io/otel/sdk/trace` package have been replaced with a single `Status` method.
This method returns the status of a span using the new `Status` type. (#1874)
- Unembed `SpanContext` in `Link`. (#1877)

### Deprecated

Expand Down
4 changes: 2 additions & 2 deletions exporters/otlp/internal/transform/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ func links(links []trace.Link) []*tracepb.Span_Link {
// being reused -- in short we need a new otLink per iteration.
otLink := otLink

tid := otLink.TraceID()
sid := otLink.SpanID()
tid := otLink.SpanContext.TraceID()
sid := otLink.SpanContext.SpanID()

sl = append(sl, &tracepb.Span_Link{
TraceId: tid[:],
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/internal/transform/span_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func TestLinks(t *testing.T) {
assert.Equal(t, expected, got[1])

// Changes to our links should not change the produced links.
l[1].SpanContext = l[1].WithTraceID(trace.TraceID{})
l[1].SpanContext = l[1].SpanContext.WithTraceID(trace.TraceID{})
assert.Equal(t, expected, got[1])
}

Expand Down
4 changes: 2 additions & 2 deletions exporters/trace/jaeger/jaeger.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ func spanSnapshotToThrift(ss *sdktrace.SpanSnapshot) *gen.Span {

var refs []*gen.SpanRef
for _, link := range ss.Links {
tid := link.TraceID()
sid := link.SpanID()
tid := link.SpanContext.TraceID()
sid := link.SpanContext.SpanID()
refs = append(refs, &gen.SpanRef{
TraceIdHigh: int64(binary.BigEndian.Uint64(tid[0:8])),
TraceIdLow: int64(binary.BigEndian.Uint64(tid[8:16])),
Expand Down
2 changes: 1 addition & 1 deletion trace/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ type Span interface {
// track the relationship.
type Link struct {
// SpanContext of the linked Span.
SpanContext
SpanContext SpanContext

// Attributes describe the aspects of the link.
Attributes []attribute.KeyValue
Expand Down

0 comments on commit 42a8450

Please sign in to comment.