1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-07-15 01:04:25 +02:00

Add Status type to SDK (#1874)

Add Status type to SDK

Use this type to encapsulate the Span status similar to the Event type
encapsulating a Span event and the Link type a span link.

Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
This commit is contained in:
Tyler Yahn
2021-05-03 19:00:54 +00:00
committed by GitHub
parent f90d0d93f8
commit b7d02db147
14 changed files with 179 additions and 134 deletions

View File

@ -64,10 +64,12 @@ func TestExporter_ExportSpan(t *testing.T) {
{Name: "foo", Attributes: []attribute.KeyValue{attribute.String("key", keyValue)}, Time: now},
{Name: "bar", Attributes: []attribute.KeyValue{attribute.Float64("double", doubleValue)}, Time: now},
},
SpanKind: trace.SpanKindInternal,
StatusCode: codes.Error,
StatusMessage: "interesting",
Resource: resource,
SpanKind: trace.SpanKindInternal,
Status: tracesdk.Status{
Code: codes.Error,
Description: "interesting",
},
Resource: resource,
}
if err := ex.ExportSpans(context.Background(), []*tracesdk.SpanSnapshot{testSpan}); err != nil {
t.Fatal(err)
@ -129,8 +131,7 @@ func TestExporter_ExportSpan(t *testing.T) {
`}` +
`],` +
`"Links":null,` +
`"StatusCode":"Error",` +
`"StatusMessage":"interesting",` +
`"Status":{"Code":"Error","Description":"interesting"},` +
`"DroppedAttributeCount":0,` +
`"DroppedMessageEventCount":0,` +
`"DroppedLinkCount":0,` +