Documentation ¶
Index ¶
- Variables
- func Module() fx.Option
- func Register(in RegisterIn)
- type ConstructorIn
- type Handler
- func (h *Handler) CacheDelete(ctx context.Context, req *flowcontrolv1.CacheDeleteRequest) (*flowcontrolv1.CacheDeleteResponse, error)
- func (h *Handler) CacheLookup(ctx context.Context, req *flowcontrolv1.CacheLookupRequest) (*flowcontrolv1.CacheLookupResponse, error)
- func (h *Handler) CacheUpsert(ctx context.Context, req *flowcontrolv1.CacheUpsertRequest) (*flowcontrolv1.CacheUpsertResponse, error)
- func (h *Handler) Check(ctx context.Context, req *flowcontrolv1.CheckRequest) (*flowcontrolv1.CheckResponse, error)
- func (h *Handler) CheckRequest(ctx context.Context, requestContext iface.RequestContext) *flowcontrolv1.CheckResponse
- func (h *Handler) FlowEnd(ctx context.Context, req *flowcontrolv1.FlowEndRequest) (*flowcontrolv1.FlowEndResponse, error)
- type HandlerWithValues
- type Metrics
- type NopMetrics
- type PrometheusMetrics
- type RegisterIn
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(in RegisterIn)
Register registers flowcontrol service on a gRPC server.
Types ¶
type ConstructorIn ¶
type ConstructorIn struct { fx.In ServiceGetter servicegetter.ServiceGetter Metrics Metrics EngineAPI iface.Engine Cache iface.Cache `optional:"true"` }
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, cache iface.Cache, ) *Handler
NewHandler creates a flowcontrol Handler.
func (*Handler) CacheDelete ¶ added in v2.24.0
func (h *Handler) CacheDelete(ctx context.Context, req *flowcontrolv1.CacheDeleteRequest) (*flowcontrolv1.CacheDeleteResponse, error)
CacheDelete is the CacheDelete method of Flow Control service deletes the cache entry with the given key.
func (*Handler) CacheLookup ¶ added in v2.25.0
func (h *Handler) CacheLookup(ctx context.Context, req *flowcontrolv1.CacheLookupRequest) (*flowcontrolv1.CacheLookupResponse, error)
CacheLookup is the CacheLookup method of Flow Control service which takes a CacheLookupRequest and returns a CacheLookupResponse.
func (*Handler) CacheUpsert ¶ added in v2.24.0
func (h *Handler) CacheUpsert(ctx context.Context, req *flowcontrolv1.CacheUpsertRequest) (*flowcontrolv1.CacheUpsertResponse, error)
CacheUpsert is the CacheUpsert method of Flow Control service updates the cache with the given key and value.
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 ¶
func (h *Handler) CheckRequest(ctx context.Context, requestContext iface.RequestContext) *flowcontrolv1.CheckResponse
CheckRequest makes decision using collected inferred fields from authz or Handler.
func (*Handler) FlowEnd ¶ added in v2.29.0
func (h *Handler) FlowEnd(ctx context.Context, req *flowcontrolv1.FlowEndRequest) (*flowcontrolv1.FlowEndResponse, error)
FlowEnd is the FlowEnd method of Flow Control service which takes a FlowEndRequest and returns a FlowEndResponse.
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( decision flowcontrolv1.CheckResponse_DecisionType, rejectReason flowcontrolv1.CheckResponse_RejectReason, controlPoint string, agentInfo *agentinfo.AgentInfo, ) FlowEnd( controlPoint string, agentInfo *agentinfo.AgentInfo, ) }
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( decision flowcontrolv1.CheckResponse_DecisionType, rejectReason flowcontrolv1.CheckResponse_RejectReason, controlPoint string, agentInfo *agentinfo.AgentInfo, )
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, controlPoint string, agentInfo *agentinfo.AgentInfo, )
CheckResponse collects metrics about Aperture Check call with DecisionType, RejectReason, Error.
type RegisterIn ¶ added in v2.16.0
type RegisterIn struct { fx.In Server *grpc.Server `name:"default"` Handler flowcontrolv1.FlowControlServiceServer HealthServer *health.Server }
RegisterIn bundles and annotates parameters.