mirror of
https://github.com/go-kratos/kratos.git
synced 2026-05-22 10:15:24 +02:00
fix spanid
This commit is contained in:
+2
-4
@@ -51,8 +51,7 @@ func Timestamp(layout string) Valuer {
|
||||
// TraceID returns a traceid valuer.
|
||||
func TraceID() Valuer {
|
||||
return func(ctx context.Context) interface{} {
|
||||
span := trace.SpanContextFromContext(ctx)
|
||||
if span.HasTraceID() {
|
||||
if span := trace.SpanContextFromContext(ctx); span.HasTraceID() {
|
||||
return span.TraceID().String()
|
||||
}
|
||||
return ""
|
||||
@@ -62,8 +61,7 @@ func TraceID() Valuer {
|
||||
// SpanID returns a spanid valuer.
|
||||
func SpanID() Valuer {
|
||||
return func(ctx context.Context) interface{} {
|
||||
span := trace.SpanContextFromContext(ctx)
|
||||
if span.HasSpanID() {
|
||||
if span := trace.SpanContextFromContext(ctx); span.HasSpanID() {
|
||||
return span.SpanID().String()
|
||||
}
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user