Documentation
¶
Index ¶
- func NewCompositeCostEstimator(estimators ...checker.CostEstimator) checker.CostEstimator
- type CEL
- func (c *CEL) CreateEvalContext(event *events.EnrichedEvent) map[string]any
- func (c *CEL) EvaluateExpression(event *events.EnrichedEvent, expression string) (string, error)
- func (c *CEL) EvaluateRule(event *events.EnrichedEvent, expressions []typesv1.RuleExpression) (bool, error)
- func (c *CEL) EvaluateRuleWithContext(evalContext map[string]any, eventType utils.EventType, ...) (bool, error)
- func (c *CEL) RegisterCustomType(eventType utils.EventType, obj interface{}) error
- func (c *CEL) RegisterEventConverter(eventType utils.EventType, converter func(utils.K8sEvent) utils.K8sEvent)
- func (c *CEL) RegisterHelper(function cel.EnvOption) error
- type CompositeCostEstimator
- type RuleEvaluator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCompositeCostEstimator ¶
func NewCompositeCostEstimator(estimators ...checker.CostEstimator) checker.CostEstimator
Types ¶
type CEL ¶
type CEL struct {
// contains filtered or unexported fields
}
func NewCEL ¶
func NewCEL(objectCache objectcache.ObjectCache, cfg config.Config) (*CEL, error)
func (*CEL) CreateEvalContext ¶ added in v0.3.108
func (c *CEL) CreateEvalContext(event *events.EnrichedEvent) map[string]any
CreateEvalContext builds a CEL evaluation context for the given event. The returned map is safe to reuse across multiple sequential EvaluateRuleWithContext calls for the same event — program.Eval reads but does not mutate it.
func (*CEL) EvaluateExpression ¶
func (*CEL) EvaluateRule ¶
func (c *CEL) EvaluateRule(event *events.EnrichedEvent, expressions []typesv1.RuleExpression) (bool, error)
func (*CEL) EvaluateRuleWithContext ¶ added in v0.3.108
func (c *CEL) EvaluateRuleWithContext(evalContext map[string]any, eventType utils.EventType, expressions []typesv1.RuleExpression) (bool, error)
EvaluateRuleWithContext evaluates expressions against a pre-built evaluation context. Callers who process multiple rules for the same event should build the context once via CreateEvalContext and reuse it here to avoid per-rule allocation.
func (*CEL) RegisterCustomType ¶
func (*CEL) RegisterEventConverter ¶ added in v0.3.31
type CompositeCostEstimator ¶
type CompositeCostEstimator struct {
// contains filtered or unexported fields
}
CompositeCostEstimator holds multiple estimators and queries them in order.
func (*CompositeCostEstimator) EstimateCallCost ¶
func (c *CompositeCostEstimator) EstimateCallCost(function, overloadID string, target *checker.AstNode, args []checker.AstNode) *checker.CallEstimate
EstimateCallCost iterates through its estimators and returns the first non-nil estimate.
func (*CompositeCostEstimator) EstimateSize ¶
func (c *CompositeCostEstimator) EstimateSize(element checker.AstNode) *checker.SizeEstimate
EstimateSize iterates through its estimators for a size estimate.
type RuleEvaluator ¶ added in v0.3.31
type RuleEvaluator interface {
EvaluateRule(event *events.EnrichedEvent, expressions []typesv1.RuleExpression) (bool, error)
EvaluateRuleWithContext(evalContext map[string]any, eventType utils.EventType, expressions []typesv1.RuleExpression) (bool, error)
EvaluateExpression(event *events.EnrichedEvent, expression string) (string, error)
CreateEvalContext(event *events.EnrichedEvent) map[string]any
RegisterHelper(function cel.EnvOption) error
RegisterCustomType(eventType utils.EventType, obj interface{}) error
RegisterEventConverter(eventType utils.EventType, converter func(utils.K8sEvent) utils.K8sEvent)
}