Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/observability / / CostTrackerOptions

Interface: CostTrackerOptions

Defined in: packages/observability/src/cost/types.ts:124

Configuration shape for createCostTracker.

Stable

Properties

PropertyModifierTypeDescriptionDefined in
budgets?readonlyCostBudgets-packages/observability/src/cost/types.ts:125
onEviction?readonly(event) => voidW-092: observer for retention evictions (dashboards / warnings).packages/observability/src/cost/types.ts:147
onExceed?readonlyCostBudgetExceededCallback-packages/observability/src/cost/types.ts:126
retention?readonly| false | { maxScopeEntries?: number; maxSpanEntries?: number; }W-092: memory bound for the tracker's internal maps. The tracker aggregates for the LIFETIME of the process - exactly the long-running-assistant scenario - so unbounded per-span / per-scope maps are a leak. When an insertion pushes a map past its limit the OLDEST entries (insertion order, not LRU) are evicted and onEviction fires per dropped id; usage() / usageForSpan() for an evicted id then report zero figures, and a late rollup to an evicted ancestor re-creates it from zero. Defaults to { maxSpanEntries: 10_000, maxScopeEntries: 10_000 }; pass false to restore the previous unbounded behaviour.packages/observability/src/cost/types.ts:139