soheilhy / cmux

Connection multiplexer for GoLang: serve different services on the same port!
Apache License 2.0
2.53k stars 197 forks source link

Multiplexing gRPC and Prometheus metrics services using Google Cloud Run #86

Open DazWilkin opened 3 years ago

DazWilkin commented 3 years ago

cmux is very useful.

Thank you!

Google Cloud Run is a serverless solution built atop Knative and it limits deployed services to a single port.

This is a challenge when running, e.g. gRPC services that also expose Prometheus metrics.

Using cmux, I'm able to multiplex both services onto the single port and serve gRPC and Prometheus metrics with little effort.

I wrote up the solution here: Multiplexing gRPC and HTTP (Prometheus) endpoints with Cloud Run

NOTE I did need to use the Java gRPC client solution to get this to work (locally and when deployed to Cloud Run) with Golang clients (my own and gRPCurl