diff --git a/tracing.go b/tracing.go index 9c585287..b7710688 100644 --- a/tracing.go +++ b/tracing.go @@ -760,12 +760,13 @@ func (ss SpanStatus) MarshalJSON() ([]byte, error) { // A TraceContext carries information about an ongoing trace and is meant to be // stored in Event.Contexts (as *TraceContext). type TraceContext struct { - TraceID TraceID `json:"trace_id"` - SpanID SpanID `json:"span_id"` - ParentSpanID SpanID `json:"parent_span_id"` - Op string `json:"op,omitempty"` - Description string `json:"description,omitempty"` - Status SpanStatus `json:"status,omitempty"` + TraceID TraceID `json:"trace_id"` + SpanID SpanID `json:"span_id"` + ParentSpanID SpanID `json:"parent_span_id"` + Op string `json:"op,omitempty"` + Description string `json:"description,omitempty"` + Status SpanStatus `json:"status,omitempty"` + Data map[string]interface{} `json:"data,omitempty"` } func (tc *TraceContext) MarshalJSON() ([]byte, error) { @@ -808,6 +809,10 @@ func (tc TraceContext) Map() map[string]interface{} { m["status"] = tc.Status } + if len(tc.Data) > 0 { + m["data"] = tc.Data + } + return m }