Skip to content

Commit

Permalink
set status and tracestate
Browse files Browse the repository at this point in the history
  • Loading branch information
moh-osman3 committed Jun 3, 2023
1 parent c8fa020 commit 2718ebe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lightstep/sdk/trace/exporters/otlp/otelcol/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/pdata/ptrace/ptraceotlp"
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver/receivertest"
Expand Down Expand Up @@ -299,6 +300,9 @@ func (t *clientTestSuite) TestD2PD() {
t.Equal(uint32(roSpan.DroppedLinks()), actualSpan.DroppedLinksCount())
t.Equal(uint32(roSpan.DroppedEvents()), actualSpan.DroppedEventsCount())
t.Equal(uint32(roSpan.SpanKind()), uint32(actualSpan.Kind()))
t.Equal(roSpan.SpanContext().TraceState().String(), actualSpan.TraceState().AsRaw())
t.Equal(ptrace.StatusCode(roSpan.Status().Code), actualSpan.Status().Code())
t.Equal(roSpan.Status().Description, actualSpan.Status().Message())

for _, attr := range roSpan.Attributes() {
actualVal, ok := actualSpan.Attributes().Get(string(attr.Key))
Expand Down
3 changes: 3 additions & 0 deletions lightstep/sdk/trace/exporters/otlp/otelcol/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ func (c *client) d2pd(in []trace.ReadOnlySpan) ptrace.Traces {
s.SetStartTimestamp(pcommon.NewTimestampFromTime(tr.StartTime()))
s.SetEndTimestamp(pcommon.NewTimestampFromTime(tr.EndTime()))
s.SetTraceID(pcommon.TraceID(tr.SpanContext().TraceID()))
s.TraceState().FromRaw(tr.SpanContext().TraceState().String())
s.Status().SetCode(ptrace.StatusCode(tr.Status().Code))
s.Status().SetMessage(tr.Status().Description)

copyAttributes(s.Attributes(), attribute.NewSet(tr.Attributes()...))
copyEvents(s.Events(), tr.Events())
Expand Down

0 comments on commit 2718ebe

Please sign in to comment.