Documentation
¶
Overview ¶
Package accounting tracks per-sandbox and per-profile token and spend usage, exposes Prometheus counters, and supports budget checks.
Index ¶
- type Tracker
- func (t *Tracker) Forget(sandbox string)
- func (t *Tracker) Over(sandbox string, maxTokens int64, maxCostUSD float64) (bool, string)
- func (t *Tracker) ProfileUsage(profile string) Usage
- func (t *Tracker) Record(profile, sandbox string, tokens int64, costUSD float64)
- func (t *Tracker) Usage(sandbox string) Usage
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker accumulates usage per sandbox and per profile. It is safe for concurrent use.
func (*Tracker) Forget ¶
Forget drops a sandbox's per-sandbox entry, typically when the sandbox is killed. Profile totals are cumulative and retained.
func (*Tracker) Over ¶
Over reports whether a sandbox's usage meets or exceeds a positive limit. A limit that is <= 0 means "no limit" for that dimension. When over, the second return value is a human-readable explanation.
func (*Tracker) ProfileUsage ¶
ProfileUsage returns the cumulative totals for a profile. Unknown profiles return the zero Usage.