Coverage for app / services / stats / __init__.py: 100%

4 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-10-31 11:21 +0000

1""" 

2Dimensioned platform statistics. 

3 

4svc-ai's usage and trace stats answer "what has this account spent?" — one 

5figure for everything. This package answers "what has *this agent* spent?", 

6and the same question of a model, a project or an organisation, over a chosen 

7window, for any of the figures the governance usage ledger records. 

8 

9Three registries and a query: 

10 

11``metrics`` what figure to report — tokens, spend, latency, errors 

12``dimensions`` what to slice it by — agent, model, skill, worker, project, … 

13``periods`` over what window 

14``breakdown`` the query that puts the three together 

15 

16Adding a capability is adding one class to one registry. The catalogue 

17endpoint serves all three, so a new metric appears in the widget editor's 

18picker without a frontend release — the same contract the rule builder and 

19the widget registry already work to. 

20""" 

21 

22# Re-exported so callers import one name from one place. Marked, because 

23# `ruff --fix` strips an unused import at commit time and would quietly empty 

24# this file. 

25from .breakdown import ( # noqa: F401 

26 Breakdown, 

27 BreakdownError, 

28 Bucket, 

29 catalogue, 

30 compute, 

31) 

32from .dimensions import get_dimension, register_dimension # noqa: F401 

33from .metrics import get_metric, register_metric # noqa: F401 

34from .periods import get_period # noqa: F401