fix tracing: call tracer.End() in closure. (#928)

pull/931/head
dowenliu-xyz 4 years ago committed by GitHub
parent ba5b8d1ee3
commit aab0d5aa43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      middleware/tracing/tracing.go

@ -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…
Cancel
Save