Documentation ¶
Index ¶
- Constants
- func ClientIP(md metadata.MD) string
- func ClientName(md metadata.MD) string
- 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 HeaderGet(h Header, name string) string
- func IsGRPCRequest(r *http.Request) bool
- func ListGRPCResources(server *grpc.Server) []string
- func WithClientApp(ctx context.Context, name string) context.Context
- func WithClientIp(ctx context.Context, ip string) context.Context
- 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
- type Header
Constants ¶
View Source
const ( DefaultContentType = "application/grpc" DefaultTimeout = time.Second * 2 )
View Source
const ( ClientNameKey = "client-name" ClientIpKey = "client-ip" ClientHostnameKey = "client-hostname" ClientPathKey = "client-path" ClientVersionKey = "client-version" )
Variables ¶
This section is empty.
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 ListGRPCResources ¶ added in v0.2.11
ListGRPCResources is a helper function that lists all URLs that are registered on gRPC server.
This makes it easy to register all the relevant routes in your HTTP router of choice.
func WithClientApp ¶ added in v0.2.11
WithClientApp 获取对端应用名称
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
Click to show internal directories.
Click to hide internal directories.