1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-25 22:41:46 +02:00

Unembed SpanContext (#1877)

* Unembed SpanContext

rebase branch

* Update CHANGELOG
This commit is contained in:
Iris Song
2021-05-03 17:10:02 -07:00
committed by GitHub
parent b7d02db147
commit 42a845093e
5 changed files with 7 additions and 6 deletions

View File

@@ -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) - 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. - 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) This method returns the status of a span using the new `Status` type. (#1874)
- Unembed `SpanContext` in `Link`. (#1877)
### Deprecated ### Deprecated

View File

@@ -155,8 +155,8 @@ func links(links []trace.Link) []*tracepb.Span_Link {
// being reused -- in short we need a new otLink per iteration. // being reused -- in short we need a new otLink per iteration.
otLink := otLink otLink := otLink
tid := otLink.TraceID() tid := otLink.SpanContext.TraceID()
sid := otLink.SpanID() sid := otLink.SpanContext.SpanID()
sl = append(sl, &tracepb.Span_Link{ sl = append(sl, &tracepb.Span_Link{
TraceId: tid[:], TraceId: tid[:],

View File

@@ -148,7 +148,7 @@ func TestLinks(t *testing.T) {
assert.Equal(t, expected, got[1]) assert.Equal(t, expected, got[1])
// Changes to our links should not change the produced links. // 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]) assert.Equal(t, expected, got[1])
} }

View File

@@ -213,8 +213,8 @@ func spanSnapshotToThrift(ss *sdktrace.SpanSnapshot) *gen.Span {
var refs []*gen.SpanRef var refs []*gen.SpanRef
for _, link := range ss.Links { for _, link := range ss.Links {
tid := link.TraceID() tid := link.SpanContext.TraceID()
sid := link.SpanID() sid := link.SpanContext.SpanID()
refs = append(refs, &gen.SpanRef{ refs = append(refs, &gen.SpanRef{
TraceIdHigh: int64(binary.BigEndian.Uint64(tid[0:8])), TraceIdHigh: int64(binary.BigEndian.Uint64(tid[0:8])),
TraceIdLow: int64(binary.BigEndian.Uint64(tid[8:16])), TraceIdLow: int64(binary.BigEndian.Uint64(tid[8:16])),

View File

@@ -555,7 +555,7 @@ type Span interface {
// track the relationship. // track the relationship.
type Link struct { type Link struct {
// SpanContext of the linked Span. // SpanContext of the linked Span.
SpanContext SpanContext SpanContext
// Attributes describe the aspects of the link. // Attributes describe the aspects of the link.
Attributes []attribute.KeyValue Attributes []attribute.KeyValue