Skip to content

Use FOCUS columns in reporting scripts and dashboard#252

Merged
jnioche merged 2 commits into
mainfrom
239
Jul 16, 2026
Merged

Use FOCUS columns in reporting scripts and dashboard#252
jnioche merged 2 commits into
mainfrom
239

Conversation

@jnioche

@jnioche jnioche commented Jul 16, 2026

Copy link
Copy Markdown
Member

Fixes #239

Makes the reporting scripts (reporting/report.py, reporting/dashboard.py) provider-neutral by querying the FOCUS (FinOps Open Cost & Usage Specification) columns emitted by all SPRUCE pipelines, instead of raw AWS CUR columns.

What changed

Pipeline side

  • FOCUSColumns bridge modules map provider-native billing columns to FOCUS names (BilledCost, ServiceName, ChargeCategory, RegionId, SubAccountId, ChargePeriodStart/End, Tags, SkuMeter, ...) for the native AWS and Azure pipelines; FOCUS exports already carry them
  • The InstanceTypeExtraction modules and SpruceColumn.INSTANCE_TYPE were removed; the instance type is now derived from SkuMeter on the reporting side

Reporting side

  • All queries use standard FOCUS columns plus SPRUCE-generated columns only — no provider-specific x_ columns
  • Top instance types are parsed from SkuMeter (FOCUS 1.2, e.g. EUW2-BoxUsage:t3.xlarge); inputs that do not populate it get an empty section
  • Tag breakdowns handle Tags stored as a MAP (AWS) or a JSON string (Azure)
  • BILLING_PERIOD is inferred from ChargePeriodStart when the input is not hive-partitioned by billing period (handles ISO timestamps, ISO strings, and US-style Azure dates)
  • Columns missing from an input are injected as typed NULLs, and known columns are aliased to their canonical case, so the same queries run on the output of every pipeline
  • Docs and reporting README updated to match

Testing

Report and dashboard verified end-to-end against four enriched datasets: AWS CUR (hourly, hive-partitioned), AWS FOCUS (daily, flat), Azure cost details, and Azure FOCUS. Totals match across export formats of the same account; per-service splits legitimately differ where the provider's own ServiceName taxonomy differs from meter categories.

report.py and dashboard.py now query only standard FOCUS columns
(ServiceName, ChargeCategory, BilledCost, ListCost, SkuMeter, Tags) plus
the SPRUCE-generated ones, so the same queries run on the enriched
output of every pipeline (AWS CUR, AWS FOCUS, Azure, Azure FOCUS). No
provider-specific x_ columns are used.

- Instance types are derived from SkuMeter alone (FOCUS 1.2); inputs
  that do not populate it get an empty section
- Tag breakdowns support Tags stored as a MAP (AWS) or a JSON string
  (Azure)
- BILLING_PERIOD is inferred from ChargePeriodStart when the input is
  not hive-partitioned by billing period
- Known columns are aliased to their canonical case when loading, so
  e.g. a billing_period parquet column works like the BILLING_PERIOD
  hive partition
- Missing columns are injected as typed NULLs so every query runs
  everywhere
- Update reporting README and docs to match
@jnioche jnioche added the FOCUS label Jul 16, 2026
@jnioche jnioche added this to the 1.2 milestone Jul 16, 2026
@jnioche
jnioche merged commit 733298d into main Jul 16, 2026
3 checks passed
@jnioche
jnioche deleted the 239 branch July 16, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use FOCUS columns in reporting scripts and dashboard

1 participant