Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump go-grpc-middleware to v2 #32

Merged
merged 1 commit into from
Jun 8, 2023
Merged

Bump go-grpc-middleware to v2 #32

merged 1 commit into from
Jun 8, 2023

Conversation

AlejoAsd
Copy link
Contributor

@AlejoAsd AlejoAsd commented Jun 7, 2023

Context

Closes #20.

We're using go-grpc-middleware to provide a set of gRPC interceptors for net.Servers. We're still using go-grpc-middleware/v1, which is quite old and has caused issues with some downstream applications that use gz-go.

Changes

Most of the changes required to migrate from v1 to v2 required updating package addresses and minor modification of some interceptors.

Interceptors

A number of default interceptors had to be updated because they were deprecated, moved or updated.

  • grpc_ctxtags was removed from go-grpc-middleware as a new internal mechanism is now available for different interceptors to communicate. The interceptor was removed from the set of default interceptors.
  • grpc_opentracing was removed from go-grpc-middleware in favor of OTel implementations. The tracing interceptor package was replaced by the google.golang.org/grpc/otelgrpc package.
  • Other existing interceptors had their packages updated to match the new package structure imposed by go-grpc-middleware, but no other changes were necessary.

Additional changes

  • grpc_middleware.ChainUnaryServer was removed from go-grpc-middleware as the grpc package introduced grpc.ChainUnaryInterceptor to do the same thing.
    • GenerateStreamServerInterceptorsChainWithBase and GenerateStreamServerInterceptorsChainWithBase were updated to use the new grpc methods. These methods now return ServerOptions instead of a slice of interceptors.
    • NewServerOptionsGRPC was updated to call the modified methods directly, as opposed to wrapping them with grpc.Stream/UnaryInterceptor([...]) since the inner function now returns a ServerOption and no conversion is necessary.
  • The testing go-grpc-middleware/testing and go-grpc-middleware/testing/testproto packages were merged into a single go-gprc/middleware/v2/testing/testpb package. All references to these packages were updated.
  • The go-grpc-middleware/util/metautils package was reorganized and is now part of the go-grpc-middleware/metadata package.

Signed-off-by: Alejo Carballude <alejocarballude@gmail.com>
@AlejoAsd AlejoAsd requested a review from marcoshuck June 7, 2023 21:34
@AlejoAsd AlejoAsd self-assigned this Jun 7, 2023
@marcoshuck marcoshuck marked this pull request as ready for review June 8, 2023 16:41
@AlejoAsd AlejoAsd merged commit 2062faa into main Jun 8, 2023
@AlejoAsd AlejoAsd deleted the go-grpc-middleware_v2 branch June 8, 2023 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate from grpc-go-middleware v1 to v2
2 participants