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

Function CostTracking

cel/options.go:757–763  ·  view source on GitHub ↗

CostTracking enables cost tracking and registers a ActualCostEstimator that can optionally provide a runtime cost estimate for any function calls.

(costEstimator interpreter.ActualCostEstimator)

Source from the content-addressed store, hash-verified

755
756// CostTracking enables cost tracking and registers a ActualCostEstimator that can optionally provide a runtime cost estimate for any function calls.
757func CostTracking(costEstimator interpreter.ActualCostEstimator) ProgramOption {
758 return func(p *prog) (*prog, error) {
759 p.callCostEstimator = costEstimator
760 p.evalOpts |= OptTrackCost
761 return p, nil
762 }
763}
764
765// CostLimit enables cost tracking and sets configures program evaluation to exit early with a
766// "runtime cost limit exceeded" error if the runtime cost exceeds the costLimit.

Callers 10

TestStringFormatFunction · 0.92
TestStringFormatV2Function · 0.92
testEvalWithCostFunction · 0.92
evalWithCELFunction · 0.92
TestStringCostTrackingFunction · 0.92
TestEvalFunction · 0.85
TestCostLimitFunction · 0.85

Calls

no outgoing calls

Tested by 10

TestStringFormatFunction · 0.74
TestStringFormatV2Function · 0.74
testEvalWithCostFunction · 0.74
evalWithCELFunction · 0.74
TestStringCostTrackingFunction · 0.74
TestEvalFunction · 0.68
TestCostLimitFunction · 0.68