MCPcopy Create free account
hub / github.com/cel-expr/cel-go / CostLimit

Function CostLimit

cel/options.go:822–828  ·  view source on GitHub ↗

CostLimit enables cost tracking and sets configures program evaluation to exit early with a "runtime cost limit exceeded" error if the runtime cost exceeds the costLimit. The CostLimit is a metric that corresponds to the number and estimated expense of operations performed while evaluating an expres

(costLimit uint64)

Source from the content-addressed store, hash-verified

820// The CostLimit is a metric that corresponds to the number and estimated expense of operations
821// performed while evaluating an expression. It is indicative of CPU usage, not memory usage.
822func CostLimit(costLimit uint64) ProgramOption {
823 return func(p *prog) (*prog, error) {
824 p.costLimit = &costLimit
825 p.evalOpts |= OptTrackCost
826 return p, nil
827 }
828}
829
830func fieldToCELType(field protoreflect.FieldDescriptor) (*Type, error) {
831 if field.Kind() == protoreflect.MessageKind || field.Kind() == protoreflect.GroupKind {

Callers 3

TestCostLimitFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestCostLimitFunction · 0.68