Expand description
FOCUS CSV serializer (FinOps Open Cost & Usage Specification).
Spec pinned: FOCUS v1.2 (published June 2024,
https://focus.finops.org/focus-specification/v1-2/) — chosen over 1.3/1.4
because 1.2 introduced the SaaS columns (token-denominated pricing) and is
the version Vantage validates against for custom providers. All 21 v1.2
Mandatory columns are emitted, plus the v1.0 required column set
(Provider, InvoiceIssuer, ResourceID, SubAccountId, Tags, …,
mostly nullable) so the official focus-validator (pip, validates
against 1.0) passes the same file — additive columns are explicitly
allowed by the spec. lean-ctx dimensions ride in x_-prefixed custom
columns as the extensibility rules require.
Two rows per DailyCostRow:
ChargeCategory=Usage: the actual token spend through lean-ctx.ChargeCategory=Credit: verified savings as a negative cost (FOCUS’s category for granted reductions) — never mixed into Usage so budgets stay clean.
Constants§
- HEADER
- The 21 FOCUS 1.2 Mandatory columns (spec order: alphabetical), the v1.0
required/nullable compatibility set, then the
x_custom dimensions.
Functions§
- to_csv
- Serialize rows to a FOCUS 1.2 CSV document. Rows with unparseable dates are skipped (the aggregate layer already filters malformed timestamps).