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

Function CostTracking

cel/options.go:813–819  ·  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

811
812// CostTracking enables cost tracking and registers a ActualCostEstimator that can optionally provide a runtime cost estimate for any function calls.
813func CostTracking(costEstimator interpreter.ActualCostEstimator) ProgramOption {
814 return func(p *prog) (*prog, error) {
815 p.callCostEstimator = costEstimator
816 p.evalOpts |= OptTrackCost
817 return p, nil
818 }
819}
820
821// CostLimit enables cost tracking and sets configures program evaluation to exit early with a
822// "runtime cost limit exceeded" error if the runtime cost exceeds the costLimit.

Callers 14

testCostFunction · 0.92
TestStringFormatFunction · 0.92
TestStringFormatV2Function · 0.92
testEvalWithCostFunction · 0.92
evalWithCELFunction · 0.92
TestStringCostTrackingFunction · 0.92
TestDecodeNonBase64ErrorFunction · 0.92
TestEvalFunction · 0.85

Calls

no outgoing calls

Tested by 14

testCostFunction · 0.74
TestStringFormatFunction · 0.74
TestStringFormatV2Function · 0.74
testEvalWithCostFunction · 0.74
evalWithCELFunction · 0.74
TestStringCostTrackingFunction · 0.74
TestDecodeNonBase64ErrorFunction · 0.74
TestEvalFunction · 0.68