Skip to content
Snippets Groups Projects
Commit 3044dc7e authored by 邹毅贤's avatar 邹毅贤
Browse files

mod grpc tracing

parent fa394e06
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,10 @@ func NewClient(url common.URL) *Client {
if opentracing.IsGlobalTracerRegistered() {
tracer = opentracing.GlobalTracer()
conn, err = grpc.Dial(url.Location, grpc.WithInsecure(), grpc.WithBlock(),
grpc.WithUnaryInterceptor(otgrpc.OpenTracingClientInterceptor(tracer)))
grpc.WithUnaryInterceptor(
otgrpc.OpenTracingClientInterceptor(tracer, otgrpc.LogPayloads())),
grpc.WithStreamInterceptor(
otgrpc.OpenTracingStreamClientInterceptor(tracer, otgrpc.LogPayloads())))
if err != nil {
panic(err)
}
......
......@@ -73,7 +73,9 @@ func (s *Server) Start(url common.URL) {
// if global trace instance was set, then server tracer instance can be get, and span context can also be get
if opentracing.IsGlobalTracerRegistered() {
tracer := opentracing.GlobalTracer()
server = grpc.NewServer(grpc.UnaryInterceptor(otgrpc.OpenTracingServerInterceptor(tracer)))
server = grpc.NewServer(
grpc.UnaryInterceptor(otgrpc.OpenTracingServerInterceptor(tracer)),
grpc.StreamInterceptor(otgrpc.OpenTracingStreamServerInterceptor(tracer)))
} else {
server = grpc.NewServer()
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment