mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-07 23:02:12 +02:00
fix tracing: call tracer.End() in closure. (#928)
This commit is contained in:
parent
ba5b8d1ee3
commit
aab0d5aa43
@ -58,7 +58,7 @@ func Server(opts ...Option) middleware.Middleware {
|
||||
}
|
||||
}
|
||||
ctx, span := tracer.Start(ctx, component, operation, carrier)
|
||||
defer tracer.End(ctx, span, err)
|
||||
defer func() { tracer.End(ctx, span, err) }()
|
||||
|
||||
reply, err = handler(ctx, req)
|
||||
|
||||
@ -95,7 +95,7 @@ func Client(opts ...Option) middleware.Middleware {
|
||||
ctx = metadata.NewOutgoingContext(ctx, md)
|
||||
}
|
||||
ctx, span := tracer.Start(ctx, component, operation, carrier)
|
||||
defer tracer.End(ctx, span, err)
|
||||
defer func() { tracer.End(ctx, span, err) }()
|
||||
|
||||
reply, err = handler(ctx, req)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user