grpcutil

package
v0.2.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithStats

func ContextWithStats(ctx context.Context, stats *GRPCStats) context.Context

ContextWithStats Returns a new `context.Context` that holds a reference to `GRPCStats`.

func EnableAdmin

func EnableAdmin(s grpc.ServiceRegistrar) (cleanup func(), _ error)

func EnableDebug

func EnableDebug(s *grpc.Server)

func EnableHealth

func EnableHealth(srv string, s *grpc.Server)

func EnableReflection

func EnableReflection(s *grpc.Server)

func HeaderGet

func HeaderGet(h Header, name string) string

func IsGRPCRequest

func IsGRPCRequest(r *http.Request) bool

IsGRPCRequest returns true if the message is considered to be a GRPC message

Types

type GRPCStats

type GRPCStats struct {
	Duration clock.Duration
	Method   string
	Failed   float64
	Success  float64
}

func StatsFromContext

func StatsFromContext(ctx context.Context) *GRPCStats

StatsFromContext Returns the `GRPCStats` previously associated with `ctx`.

type GRPCStatsHandler

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

func NewGRPCStatsHandler() *GRPCStatsHandler

func (*GRPCStatsHandler) Close

func (c *GRPCStatsHandler) Close()

func (*GRPCStatsHandler) Collect

func (c *GRPCStatsHandler) Collect(ch chan<- prometheus.Metric)

func (*GRPCStatsHandler) Describe

func (c *GRPCStatsHandler) Describe(ch chan<- *prometheus.Desc)

func (*GRPCStatsHandler) HandleConn

func (c *GRPCStatsHandler) HandleConn(ctx context.Context, s stats.ConnStats)

func (*GRPCStatsHandler) HandleRPC

func (c *GRPCStatsHandler) HandleRPC(ctx context.Context, s stats.RPCStats)

func (*GRPCStatsHandler) TagConn

func (*GRPCStatsHandler) TagRPC

func (c *GRPCStatsHandler) TagRPC(ctx context.Context, tagInfo *stats.RPCTagInfo) context.Context
type Header = metadata.MD

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL