-
Notifications
You must be signed in to change notification settings - Fork 18
Description
The github.com/grpc-ecosystem/go-grpc-middleware
module upgraded to v2 nearly two years ago. Changes to the way logging fields are handled mean that v2 fields cannot be handled by the old github.com/grpc-ecosystem/go-grpc-middleware/tags
package (which no longer exist in the v2 version of the library). So, using this project in a gRPC server relying on the v2 middleware will lead to Sentry spans without any gRPC logging field metadata.
It should be noted that the reverse is also true, switching the code to use only the v2 library will drop support for the v1 middleware logging fields. Both versions could be used at the same time in theory, but there's a second significant issue with the v1 library which may force to remove the old version.
Simply put, the v1 library depends on a very old version of the google.golang.org/genproto
module that has been split into multiple sub-modules several years ago. This is now starting to lead to sever issues with ambiguous imports, as other projects start removing the import hints that held this together for a time. This can be temporarily alleviated with an explicit import using go get google.golang.org/genproto@latest
, but it will go away with the next go mod tidy
.
Reference compiler errors:
/home/jqueuniet/go/pkg/mod/google.golang.org/[email protected]/status/status.go:35:2: ambiguous import: found package google.golang.org/genproto/googleapis/rpc/status in multiple modules:
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215 (/home/jqueuniet/go/pkg/mod/google.golang.org/[email protected]/googleapis/rpc/status)
google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074 (/home/jqueuniet/go/pkg/mod/google.golang.org/genproto/googleapis/[email protected]/status)
/home/jqueuniet/go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/[email protected]/runtime/handler.go:13:2: ambiguous import: found package google.golang.org/genproto/googleapis/api/httpbody in multiple modules:
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215 (/home/jqueuniet/go/pkg/mod/google.golang.org/[email protected]/googleapis/api/httpbody)
google.golang.org/genproto/googleapis/api v0.0.0-20250721164621-a45f3dfb1074 (/home/jqueuniet/go/pkg/mod/google.golang.org/genproto/googleapis/[email protected]/httpbody)
/home/jqueuniet/go/pkg/mod/go.opentelemetry.io/otel/exporters/otlp/otlptrace/[email protected]/client.go:12:2: ambiguous import: found package google.golang.org/genproto/googleapis/rpc/errdetails in multiple modules:
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215 (/home/jqueuniet/go/pkg/mod/google.golang.org/[email protected]/googleapis/rpc/errdetails)
google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074 (/home/jqueuniet/go/pkg/mod/google.golang.org/genproto/googleapis/[email protected]/errdetails)
Dependency graph for google.golang.org/[email protected]
❯ go mod graph | grep google.golang.org/[email protected]
github.com/grpc-ecosystem/[email protected] google.golang.org/[email protected]
google.golang.org/[email protected] github.com/golang/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] golang.org/x/[email protected]
google.golang.org/[email protected] google.golang.org/[email protected]
google.golang.org/[email protected] honnef.co/go/[email protected]
As mentioned in the issue, one way to solve this is to add a dummy import to force the use of a recent version of genproto. Or it could be left to downstream projects, with the risk of causing frustration on their end.
Another solution could be to release a new major version of this middleware and update the module name to isolate the v2 from the v1.