|
|
@ -51,8 +51,7 @@ func Timestamp(layout string) Valuer { |
|
|
|
// TraceID returns a traceid valuer.
|
|
|
|
// TraceID returns a traceid valuer.
|
|
|
|
func TraceID() Valuer { |
|
|
|
func TraceID() Valuer { |
|
|
|
return func(ctx context.Context) interface{} { |
|
|
|
return func(ctx context.Context) interface{} { |
|
|
|
span := trace.SpanContextFromContext(ctx) |
|
|
|
if span := trace.SpanContextFromContext(ctx); span.HasTraceID() { |
|
|
|
if span.HasTraceID() { |
|
|
|
|
|
|
|
return span.TraceID().String() |
|
|
|
return span.TraceID().String() |
|
|
|
} |
|
|
|
} |
|
|
|
return "" |
|
|
|
return "" |
|
|
@ -62,8 +61,7 @@ func TraceID() Valuer { |
|
|
|
// SpanID returns a spanid valuer.
|
|
|
|
// SpanID returns a spanid valuer.
|
|
|
|
func SpanID() Valuer { |
|
|
|
func SpanID() Valuer { |
|
|
|
return func(ctx context.Context) interface{} { |
|
|
|
return func(ctx context.Context) interface{} { |
|
|
|
span := trace.SpanContextFromContext(ctx) |
|
|
|
if span := trace.SpanContextFromContext(ctx); span.HasSpanID() { |
|
|
|
if span.HasSpanID() { |
|
|
|
|
|
|
|
return span.SpanID().String() |
|
|
|
return span.SpanID().String() |
|
|
|
} |
|
|
|
} |
|
|
|
return "" |
|
|
|
return "" |
|
|
|