check

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProvideDummyHandler = fx.Annotate(NewHandler, fx.As(new(HandlerWithValues)))

ProvideDummyHandler provides an empty Flow Control Handler.

Functions

func Module

func Module() fx.Option

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

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

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

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

CheckResponse collects metrics about Aperture Check call with DecisionType, RejectReason, Error.

Jump to

Keyboard shortcuts

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