usage

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package usage serves read-only rollups over the llm_usage spend ledger for the admin Usage view: a window summary plus per-agent and per-model breakdowns. The ledger is durable (rows survive agent/user deletion), so a deleted agent still appears under its snapshot identity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Report

type Report struct {
	WindowDays int32
	Summary    dbq.UsageSummaryRow
	ByAgent    []dbq.UsageByAgentRow
	ByModel    []dbq.UsageByModelRow
	ByUser     []dbq.UsageByUserRow
}

Report is the full Usage view payload for one window.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(d *db.DB, logger *zap.Logger) *Service

func (*Service) Get

func (s *Service) Get(ctx context.Context, p authz.Principal, windowDays int32) (Report, error)

Get returns the ledger rollups for the last windowDays (0 = all time). Admin-gated via the tenant axis.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL