Expand description
Pluggable cost ledger. The hot path enqueues onto a bounded channel drained by a background writer; on a full channel we drop + count, never block.
Modules§
- connect
- Resilient ledger wiring: connect configured sinks independently; on failure log and continue. When no sink connects, fall back to a no-op store so the gateway still starts and serves traffic.
- event
- talos-aligned published usage event (camelCase JSON). Decouples the wire
format from the DB-shaped
UsageEntry. Mirrors the conventions oftalos-core/src/tool_events.rs(ToolEvent):rename_all = "camelCase", tenancy asnamespace, atypediscriminator, RFC3339 timestamp. - sqlite
- SQLite ledger backend (feature
ledger-sqlite).
Structs§
- Fanout
Ledger - Records each entry to every configured sink, concurrently and independently.
A sink failing never blocks the others; per-sink failures are logged and
counted on
synapse_ledger_errors_total{backend=<label>}. Always returnsOk— the ledger is fire-and-forget; the fan-out owns error reporting. - InMemory
Ledger - In-memory store for tests.
- Ledger
Handle - Fire-and-forget handle. Cloneable; the hot path calls
enqueue. - Noop
Ledger - Discards all usage events. Used when no ledger sink could be connected.
- Usage
Entry