common icon indicating copy to clipboard operation
common copied to clipboard

Broken grpc.WithBalancerName

Open metalmatze opened this issue 2 years ago • 5 comments

After updating to google.golang.org/grpc v1.46.0 I cannot compile anymore with the following error:

../../../../pkg/mod/github.com/weaveworks/[email protected]/httpgrpc/server/server.go:137:8: undefined: grpc.WithBalancerName

It seems that the WithBalancerName was actually removed in grpc after it was deprecated for some time https://github.com/grpc/grpc-go/pull/5232

The code in this repository that needs updating can be found here: https://github.com/weaveworks/common/blob/f83ccc76d8237acd9d0fa0c68b61298fbb2cb03d/httpgrpc/server/server.go#L137

metalmatze avatar May 03 '22 09:05 metalmatze

Thanks for spotting this. Upgrades to gRPC are always a bit fraught.

That said, I think httpgrpc server.NewClient can be deleted. It isn't used in Cortex or Mimir, or in the Grafana Labs closed-source relating to those projects, and I also well remember removing its usage from Weaveworks' closed source.

It might be a bit more polite to replace with:

const grpcServiceConfig = `{"loadBalancingPolicy":"round_robin"}`
grpc.WithDefaultServiceConfig(grpcServiceConfig),

bboreham avatar May 03 '22 09:05 bboreham

I was able to workaround this by using another version of grpc: go get -d google.golang.org/[email protected]. The packages I wanted to use with weaveworks/common were able to work that that version of grpc.

ryepup avatar Aug 02 '22 16:08 ryepup

I was able to workaround this by using another version of grpc: go get -d google.golang.org/[email protected]. The packages I wanted to use with weaveworks/common were able to work that that version of grpc.

Lucky guy. I'm stuck on OpenTelemetry Go v1.6.3 as later versions require gRPC > v1.45.0 and another dependency relies on weaveworks/common :/

Unfortunately only workaround seems to be to add a replace to a fork that contains a fix.

lukasmalkmus avatar Aug 09 '22 07:08 lukasmalkmus

Is your problem fixed by #240 ? Please comment there if you have tested it for forwards/backwards compatibility.

bboreham avatar Aug 09 '22 12:08 bboreham

Yes, it is fixed by #240! I replaced it in my go.mod with that branch. Unfortunately I have not tested it for forwards/backwards compatability as I only depend on this package because it is imported by grafana/loki. I directly depend on a newer version of google.golang.org/grpc.

lukasmalkmus avatar Aug 09 '22 13:08 lukasmalkmus