breaking changes to trace

31 views
Skip to first unread message

Jaana Burcu Dogan

unread,
Jun 22, 2017, 5:36:10 PM6/22/17
to google-api-...@googlegroups.com
The cloud.google.com/go/trace package will soon break three APIs:

1. traceGRPCServerInterceptor will be provided from *trace.Client.

var tc *trace.Client // initialize the client

Instead of

s := grpc.NewServer(grpc.UnaryInterceptor(trace.GRPCServerInterceptor(tc)))

write

s := grpc.NewServer(grpc.UnaryInterceptor(tc.GRPCServerInterceptor()))

2. trace.GRPCClientInterceptor will too provided from *trace.Client.

Instead of

conn, err := grpc.Dial(srv.Addr, grpc.WithUnaryInterceptor(trace.GRPCClientInterceptor()))

write

conn, err := grpc.Dial(srv.Addr, grpc.WithUnaryInterceptor(tc.GRPCClientInterceptor()))

3. We removed the deprecated trace.EnableGRPCTracing. Use the gRPC interceptor as a dial option as shown below when initializing Cloud package clients:

pubsubClient, err := pubsub.NewClient(ctx, "project-id", option.WithGRPCDialOption(grpc.WithUnaryInterceptor(tc.GRPCClientInterceptor())))
if err != nil {
    log.Fatal(err)
}
Reply all
Reply to author
Forward
0 new messages