Documentation
¶
Index ¶
- Variables
- func ContextWithStats(ctx context.Context, stats *GRPCStats) context.Context
- func EnableAdmin(s grpc.ServiceRegistrar) (cleanup func(), _ error)
- func EnableDebug(s *grpc.Server)
- func EnableHealth(srv string, s *grpc.Server)
- func EnableReflection(s *grpc.Server)
- func IsGRPCRequest(r *http.Request) bool
- func NewAuthlessReflectionInterceptor(srv reflection.GRPCServer) reflection.GRPCServer
- func NoopUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- func WithCustomCerts(certPath string, insecureSkipVerify bool) grpc.DialOption
- func WithSystemCerts(insecureSkipVerify bool) grpc.DialOption
- func WrapMethods(svcDesc grpc.ServiceDesc, interceptors ...grpc.UnaryServerInterceptor) (wrapped *grpc.ServiceDesc)
- func WrapStreams(svcDesc grpc.ServiceDesc, interceptors ...grpc.StreamServerInterceptor) (wrapped *grpc.ServiceDesc)
- type GRPCStats
- type GRPCStatsHandler
- func (c *GRPCStatsHandler) Close()
- func (c *GRPCStatsHandler) Collect(ch chan<- prometheus.Metric)
- func (c *GRPCStatsHandler) Describe(ch chan<- *prometheus.Desc)
- func (c *GRPCStatsHandler) HandleConn(ctx context.Context, s stats.ConnStats)
- func (c *GRPCStatsHandler) HandleRPC(ctx context.Context, s stats.RPCStats)
- func (c *GRPCStatsHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context
- func (c *GRPCStatsHandler) TagRPC(ctx context.Context, tagInfo *stats.RPCTagInfo) context.Context
Constants ¶
This section is empty.
Variables ¶
var DefaultUnaryMiddleware = []grpc.UnaryServerInterceptor{grpcvalidate.UnaryServerInterceptor()}
DefaultUnaryMiddleware is a recommended set of middleware that should each gracefully no-op if the middleware is not applicable.
Functions ¶
func ContextWithStats ¶ added in v0.1.26
ContextWithStats Returns a new `context.Context` that holds a reference to `GRPCStats`.
func EnableAdmin ¶ added in v0.1.26
func EnableAdmin(s grpc.ServiceRegistrar) (cleanup func(), _ error)
func EnableDebug ¶
func EnableHealth ¶
func EnableReflection ¶
func IsGRPCRequest ¶ added in v0.1.26
IsGRPCRequest returns true if the message is considered to be a GRPC message
func NewAuthlessReflectionInterceptor ¶
func NewAuthlessReflectionInterceptor(srv reflection.GRPCServer) reflection.GRPCServer
NewAuthlessReflectionInterceptor creates a proxy GRPCServer which automatically converts ServerReflectionServer instances to onces that skip grpc auth middleware.
change: reflection.Register(srv) to: reflection.Register(grpcutil.NewAuthlessReflectionInterceptor(srv))
func NoopUnaryInterceptor ¶
func NoopUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
NoopUnaryInterceptor is a gRPC middleware that does not do anything.
func WithCustomCerts ¶
func WithCustomCerts(certPath string, insecureSkipVerify bool) grpc.DialOption
WithCustomCerts is a dial option for requiring TLS from a specified path. If the path is a directory, all certs are loaded. If it is an individual file only the directly specified cert is loaded.
This function panics if custom certificate pool cannot be instantiated.
func WithSystemCerts ¶
func WithSystemCerts(insecureSkipVerify bool) grpc.DialOption
WithSystemCerts is a dial option for requiring TLS with the system certificate pool.
This function panics if the system pool cannot be loaded.
func WrapMethods ¶
func WrapMethods(svcDesc grpc.ServiceDesc, interceptors ...grpc.UnaryServerInterceptor) (wrapped *grpc.ServiceDesc)
WrapMethods wraps all non-streaming endpoints with the given list of interceptors. It returns a copy of the ServiceDesc with the new wrapped methods.
func WrapStreams ¶
func WrapStreams(svcDesc grpc.ServiceDesc, interceptors ...grpc.StreamServerInterceptor) (wrapped *grpc.ServiceDesc)
WrapStreams wraps all streaming endpoints with the given list of interceptors. It returns a copy of the ServiceDesc with the new wrapped methods.
Types ¶
type GRPCStats ¶ added in v0.1.26
func StatsFromContext ¶ added in v0.1.26
StatsFromContext Returns the `GRPCStats` previously associated with `ctx`.
type GRPCStatsHandler ¶ added in v0.1.26
type GRPCStatsHandler struct {
// contains filtered or unexported fields
}
GRPCStatsHandler Implements the Prometheus collector interface. Such that when the /metrics handler is called this collector pulls all the stats from
func NewGRPCStatsHandler ¶ added in v0.1.26
func NewGRPCStatsHandler() *GRPCStatsHandler
func (*GRPCStatsHandler) Close ¶ added in v0.1.26
func (c *GRPCStatsHandler) Close()
func (*GRPCStatsHandler) Collect ¶ added in v0.1.26
func (c *GRPCStatsHandler) Collect(ch chan<- prometheus.Metric)
func (*GRPCStatsHandler) Describe ¶ added in v0.1.26
func (c *GRPCStatsHandler) Describe(ch chan<- *prometheus.Desc)
func (*GRPCStatsHandler) HandleConn ¶ added in v0.1.26
func (c *GRPCStatsHandler) HandleConn(ctx context.Context, s stats.ConnStats)
func (*GRPCStatsHandler) HandleRPC ¶ added in v0.1.26
func (c *GRPCStatsHandler) HandleRPC(ctx context.Context, s stats.RPCStats)
func (*GRPCStatsHandler) TagConn ¶ added in v0.1.26
func (c *GRPCStatsHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context
func (*GRPCStatsHandler) TagRPC ¶ added in v0.1.26
func (c *GRPCStatsHandler) TagRPC(ctx context.Context, tagInfo *stats.RPCTagInfo) context.Context