Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateHandler ¶
CreateHandler creates an http handler with the routes of channelz mounted to the provided prefix. pathPrefix is the prefix to which /channelz will be prepended grpcBindAddress is the TCP bind address for the gRPC service you'd like to monitor. grpcBindAddress is required since the channelz interface connects to this gRPC service. Typically you'd use the return value of CreateHandler as an argument to http.Handle For example:
http.Handle("/", channelz.CreateHandler("/foo", grpcBindAddress))
grpc.Dial is called using grpc.WithTransportCredentials(insecure.NewCredentials()). If you need custom DialOptions like credentials, TLS or interceptors, please refer to CreateHandlerWithDialOpts().
func CreateHandlerWithDialOpts ¶ added in v0.0.4
func CreateHandlerWithDialOpts(pathPrefix, grpcBindAddress string, dialOpts ...grpc.DialOption) http.Handler
CreateHandlerWithDialOpts is the same as CreateHandler but with custom []grpc.DialOption You need to provide all grpc.DialOption to be used for the internal call to grpc.Dial(). This typically includes some form of grpc.WithTransportCredentials(). Here's an example on how to use a bufconn instead of a real TCP listener: lis := bufconn.Listen(1024 * 1024) grpcserver.Serve(lis) http.Handle("/", channelzWeb.CreateHandlerWithDialOpts("/", "",
[]grpc.DialOption{ grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) { return lis.DialContext(ctx) }), }...,
))
Types ¶
This section is empty.