Skip to content

Commit

Permalink
contrib/google.golang.org/grpc.v12: update grpc contrib to work with …
Browse files Browse the repository at this point in the history
…metadata API changes.

Google's metadata API has changed, and so our grpc.v12 contrib no longer compiles.
This commit updates the grpc.v12 contrib package to use the new API.
  • Loading branch information
knusbaum committed Jan 13, 2020
1 parent 90ac9c8 commit 7758ae5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions contrib/google.golang.org/grpc.v12/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func startSpanFromContext(ctx context.Context, method, service string, rate floa
if !math.IsNaN(rate) {
opts = append(opts, tracer.Tag(ext.EventSampleRate, rate))
}
md, _ := metadata.FromContext(ctx) // nil is ok
md, _ := metadata.FromIncomingContext(ctx) // nil is ok
if sctx, err := tracer.Extract(grpcutil.MDCarrier(md)); err == nil {
opts = append(opts, tracer.ChildOf(sctx))
}
Expand Down Expand Up @@ -81,12 +81,12 @@ func UnaryClientInterceptor(opts ...InterceptorOption) grpc.UnaryClientIntercept
spanopts = append(spanopts, tracer.Tag(ext.EventSampleRate, cfg.analyticsRate))
}
span, ctx = tracer.StartSpanFromContext(ctx, "grpc.client", spanopts...)
md, ok := metadata.FromContext(ctx)
md, ok := metadata.FromOutgoingContext(ctx)
if !ok {
md = metadata.MD{}
}
_ = tracer.Inject(span.Context(), grpcutil.MDCarrier(md))
ctx = metadata.NewContext(ctx, md)
ctx = metadata.NewOutgoingContext(ctx, md)
opts = append(opts, grpc.Peer(&p))
err := invoker(ctx, method, req, reply, cc, opts...)
if p.Addr != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ package version
// Tag specifies the current release tag. It needs to be manually
// updated. A test checks that the value of Tag never points to a
// git tag that is older than HEAD.
const Tag = "v1.20.0"
const Tag = "v1.21.0"

0 comments on commit 7758ae5

Please sign in to comment.