fix tag len

pull/209/head
Tony 6 years ago
parent ca2a0228a8
commit d851aa0456
  1. 8
      pkg/net/trace/zipkin/zipkin.go

@ -29,6 +29,8 @@ func (r *report) WriteSpan(raw *trace.Span) (err error) {
traceID := model.TraceID{Low: ctx.TraceID} traceID := model.TraceID{Low: ctx.TraceID}
spanID := model.ID(ctx.SpanID) spanID := model.ID(ctx.SpanID)
parentID := model.ID(ctx.ParentID) parentID := model.ID(ctx.ParentID)
tags := raw.Tags()
logs := raw.Logs()
span := model.SpanModel{ span := model.SpanModel{
SpanContext: model.SpanContext{ SpanContext: model.SpanContext{
TraceID: traceID, TraceID: traceID,
@ -38,9 +40,9 @@ func (r *report) WriteSpan(raw *trace.Span) (err error) {
Name: raw.Name(), Name: raw.Name(),
Timestamp: raw.StartTime(), Timestamp: raw.StartTime(),
Duration: raw.Duration(), Duration: raw.Duration(),
Tags: make(map[string]string, len(raw.Tags())), Tags: make(map[string]string, len(tags)+len(logs)),
} }
for _, tag := range raw.Tags() { for _, tag := range tags {
switch tag.Key { switch tag.Key {
case trace.TagSpanKind: case trace.TagSpanKind:
switch tag.Value.(string) { switch tag.Value.(string) {
@ -64,7 +66,7 @@ func (r *report) WriteSpan(raw *trace.Span) (err error) {
} }
} }
} }
for _, lg := range raw.Logs() { for _, lg := range logs {
span.Tags[lg.Key] = string(lg.Value) span.Tags[lg.Key] = string(lg.Value)
} }
r.rpt.Send(span) r.rpt.Send(span)

Loading…
Cancel
Save