Documentation
¶
Overview ¶
Package usage persists provider-reported LLM usage outside the turn path.
Index ¶
- type Hook
- func (h *Hook) Close() error
- func (h *Hook) DroppedCount() int64
- func (*Hook) Name() string
- func (h *Hook) OnPostLLMCall(_ context.Context, hctx *hooks.PostLLMCallContext)
- func (h *Hook) PendingCallCount(sessionID string) int64
- func (*Hook) Priority() int
- func (h *Hook) QueueDepth() int
- func (h *Hook) SetDropObserver(fn func())
- func (h *Hook) Start()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Hook accepts observations without waiting for PostgreSQL. The queue bounds shutdown loss to 1024 accepted records. Under sustained database overload, excess observations are deliberately dropped rather than delaying a turn.
func (*Hook) Close ¶
Close stops admission, then drains the bounded queue before returning. It is called after agent runtimes stop, while the database pool is still available.
func (*Hook) DroppedCount ¶
func (*Hook) OnPostLLMCall ¶
func (h *Hook) OnPostLLMCall(_ context.Context, hctx *hooks.PostLLMCallContext)
func (*Hook) PendingCallCount ¶
PendingCallCount reports accepted observations that have not finished their database write. It is session-scoped so callers can distinguish a complete zero-usage session from one whose accounting is still in flight.
func (*Hook) QueueDepth ¶
func (*Hook) SetDropObserver ¶
func (h *Hook) SetDropObserver(fn func())
SetDropObserver installs a non-blocking callback for queue drops.