Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ProvideDummyHandler = fx.Annotate(NewHandler, fx.As(new(HandlerWithValues)))
ProvideDummyHandler provides an empty Flow Control Handler.
Functions ¶
func Module ¶
Module is a set of default providers for flowcontrol components
Note that the handler needs to be Registered for flowcontrol to be available externally.
func Register ¶
func Register(server *grpc.Server, handler flowcontrolv1.FlowControlServiceServer, healthsrv *health.Server)
Register registers flowcontrol service on a gRPC server.
Types ¶
type ConstructorIn ¶
type ConstructorIn struct { fx.In ServiceGetter servicegetter.ServiceGetter Metrics Metrics EngineAPI iface.Engine }
ConstructorIn holds parameters for ProvideHandler.
type Handler ¶
type Handler struct { flowcontrolv1.UnimplementedFlowControlServiceServer // contains filtered or unexported fields }
Handler implements the flowcontrol.v1 Service
It also accepts a pointer to an EntityCache for services lookup.
func NewHandler ¶
func NewHandler( serviceGetter servicegetter.ServiceGetter, metrics Metrics, engine iface.Engine, ) *Handler
NewHandler creates a flowcontrol Handler.
func (*Handler) Check ¶
func (h *Handler) Check(ctx context.Context, req *flowcontrolv1.CheckRequest) (*flowcontrolv1.CheckResponse, error)
Check is the Check method of Flow Control service returns the allow/deny decisions of whether to accept the traffic after running the algorithms.
func (*Handler) CheckRequest ¶ added in v1.2.0
func (h *Handler) CheckRequest( ctx context.Context, requestContext iface.RequestContext, ) *flowcontrolv1.CheckResponse
CheckRequest makes decision using collected inferred fields from authz or Handler.
type HandlerWithValues ¶
type HandlerWithValues interface { CheckRequest( context.Context, iface.RequestContext, ) *flowcontrolv1.CheckResponse }
HandlerWithValues implements the flowcontrol.v1 service using collected inferred values.
func ProvideHandler ¶
func ProvideHandler( in ConstructorIn, ) (flowcontrolv1.FlowControlServiceServer, HandlerWithValues, error)
ProvideHandler provides a Flow Control Handler.
type Metrics ¶
type Metrics interface { // CheckResponse collects metrics about Aperture Check call with DecisionType and Reason. CheckResponse( flowcontrolv1.CheckResponse_DecisionType, flowcontrolv1.CheckResponse_RejectReason, ) }
Metrics is used for collecting metrics about Aperture flowcontrol.
func ProvideMetrics ¶
func ProvideMetrics(promRegistry *prometheus.Registry) (Metrics, error)
ProvideMetrics provides flowcontrol metrics that hook to prometheus registry.
func ProvideNopMetrics ¶
func ProvideNopMetrics() Metrics
ProvideNopMetrics provides disabled flowcontrol metrics.
type NopMetrics ¶
type NopMetrics struct{}
NopMetrics is a no-op implementation of Metrics.
func (NopMetrics) CheckResponse ¶
func (NopMetrics) CheckResponse( flowcontrolv1.CheckResponse_DecisionType, flowcontrolv1.CheckResponse_RejectReason, )
CheckResponse is no-op method for NopMetrics.
type PrometheusMetrics ¶
type PrometheusMetrics struct {
// contains filtered or unexported fields
}
PrometheusMetrics stores collected metrics.
func NewPrometheusMetrics ¶
func NewPrometheusMetrics(registry *prometheus.Registry) (*PrometheusMetrics, error)
NewPrometheusMetrics creates a Prometheus metrics collector.
func (*PrometheusMetrics) CheckResponse ¶
func (pm *PrometheusMetrics) CheckResponse( decision flowcontrolv1.CheckResponse_DecisionType, rejectReason flowcontrolv1.CheckResponse_RejectReason, )
CheckResponse collects metrics about Aperture Check call with DecisionType, RejectReason, Error.