check

package
v2.34.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 17 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(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

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

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

CacheUpsert is the CacheUpsert method of Flow Control service updates the cache with the given key and value.

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

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

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

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.

func (NopMetrics) FlowEnd added in v2.29.0

func (NopMetrics) FlowEnd(
	controlPoint string,
	agentInfo *agentinfo.AgentInfo,
)

FlowEnd 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.

func (*PrometheusMetrics) FlowEnd added in v2.29.0

func (pm *PrometheusMetrics) FlowEnd(
	controlPoint string,
	agentInfo *agentinfo.AgentInfo,
)

FlowEnd collects metrics about Aperture FlowEnd call.

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.

Jump to

Keyboard shortcuts

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