Documentation ¶
Overview ¶
generated by protoc-gen-consul-rate-limit; DO NOT EDIT.
Index ¶
- Constants
- Variables
- func NewActiveStreamCounter(m *metrics.Metrics, labels []metrics.Label) *activeStreamCounter
- func NewOptionalTransportCredentials(creds credentials.TransportCredentials, logger Logger) credentials.TransportCredentials
- func NewPanicHandler(logger Logger) recovery.RecoveryHandlerFunc
- func NewStatsHandler(m *metrics.Metrics, labels []metrics.Label) *statsHandler
- func PanicHandlerMiddlewareOpts(logger Logger) []recovery.Option
- func ServerRateLimiterMiddleware(limiter rate.RequestLimitsHandler, panicHandler recovery.RecoveryHandlerFunc, ...) tap.ServerInHandle
- type AuthInterceptor
- type LabelledConn
- type LabelledListener
- type Logger
- type Protocol
Constants ¶
const AllowedPeerEndpointPrefix = "/hashicorp.consul.internal.peerstream.PeerStreamService/"
Variables ¶
var StatsCounters = []prometheus.CounterDefinition{ { Name: []string{"grpc", "client", "request", "count"}, Help: "Counts the number of gRPC requests made by the client agent to a Consul server.", }, { Name: []string{"grpc", "server", "request", "count"}, Help: "Counts the number of gRPC requests received by the server.", }, { Name: []string{"grpc", "client", "connection", "count"}, Help: "Counts the number of new gRPC connections opened by the client agent to a Consul server.", }, { Name: []string{"grpc", "server", "connection", "count"}, Help: "Counts the number of new gRPC connections received by the server.", }, { Name: []string{"grpc", "server", "stream", "count"}, Help: "Counts the number of new gRPC streams received by the server.", }, }
var StatsGauges = []prometheus.GaugeDefinition{ { Name: []string{"grpc", "server", "connections"}, Help: "Measures the number of active gRPC connections open on the server.", }, { Name: []string{"grpc", "client", "connections"}, Help: "Measures the number of active gRPC connections open from the client agent to any Consul servers.", }, { Name: []string{"grpc", "server", "streams"}, Help: "Measures the number of active gRPC streams handled by the server.", }, }
Functions ¶
func NewActiveStreamCounter ¶ added in v1.14.0
func NewActiveStreamCounter(m *metrics.Metrics, labels []metrics.Label) *activeStreamCounter
func NewOptionalTransportCredentials ¶ added in v1.14.0
func NewOptionalTransportCredentials(creds credentials.TransportCredentials, logger Logger) credentials.TransportCredentials
func NewPanicHandler ¶
func NewPanicHandler(logger Logger) recovery.RecoveryHandlerFunc
NewPanicHandler returns a recovery.RecoveryHandlerFunc closure function to handle panic in GRPC server's handlers.
func NewStatsHandler ¶ added in v1.14.0
func NewStatsHandler(m *metrics.Metrics, labels []metrics.Label) *statsHandler
func PanicHandlerMiddlewareOpts ¶
PanicHandlerMiddlewareOpts returns the []recovery.Option containing recovery handler function.
func ServerRateLimiterMiddleware ¶ added in v1.15.0
func ServerRateLimiterMiddleware(limiter rate.RequestLimitsHandler, panicHandler recovery.RecoveryHandlerFunc, logger Logger) tap.ServerInHandle
ServerRateLimiterMiddleware implements a ServerInHandle function to perform RPC rate limiting at the cheapest possible point (before the full request has been decoded).
Types ¶
type AuthInterceptor ¶ added in v1.14.0
type AuthInterceptor struct { TLS *tlsutil.Configurator Logger Logger }
AuthInterceptor provides gRPC interceptors for restricting endpoint access based on SNI. If the connection is plaintext, this filter will not activate, and the connection will be allowed to proceed.
func (*AuthInterceptor) InterceptStream ¶ added in v1.14.0
func (a *AuthInterceptor) InterceptStream( srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler, ) error
InterceptUnary prevents streaming gRPC calls from calling certain endpoints, based on the SNI information.
func (*AuthInterceptor) InterceptUnary ¶ added in v1.14.0
func (a *AuthInterceptor) InterceptUnary( ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (interface{}, error)
InterceptUnary prevents non-streaming gRPC calls from calling certain endpoints, based on the SNI information.
type LabelledConn ¶ added in v1.14.0
LabelledConn wraps a connection and provides extra metadata fields.
type LabelledListener ¶ added in v1.14.0
LabelledListener wraps a listener and attaches pre-specified fields to each spawned connection.