Grpc-gateway: Support pprof tools with runtime.ServerMux

Created on 18 Oct 2016  路  3Comments  路  Source: grpc-ecosystem/grpc-gateway

Hi,
I am interested in running pprof tools with GRPC gateway. How can I do that without running a separate server just for pprof?

Thanks.

question

Most helpful comment

You can simply import _ "net/http/pprof" if you reuse http.DefaultServeMux.

examples/main.go shows a way to combine http.ServeMux with github.com/grpc-ecosystem/grpc-gateway/runtime.ServeMux. However, I should have reuse http.DefaultServeMux in this example instead of calling http.NewServeMux(). If you reuse, import _ "net/http/pprof" will take effect.

All 3 comments

You can simply import _ "net/http/pprof" if you reuse http.DefaultServeMux.

examples/main.go shows a way to combine http.ServeMux with github.com/grpc-ecosystem/grpc-gateway/runtime.ServeMux. However, I should have reuse http.DefaultServeMux in this example instead of calling http.NewServeMux(). If you reuse, import _ "net/http/pprof" will take effect.

Thanks @yugui .

Good question. I have the same

Was this page helpful?
0 / 5 - 0 ratings