Intelligence & Services → Operational Services

Usage & Billing

Meters consumption per tenant/team across ingestion volume, query compute, and storage — the basis for internal chargeback or external multi-tenant billing.

High-Level Design

Usage & Billing turns platform consumption into an attributable, auditable number.

Data Source
Data Sources
Every touchpoint and business system
→
Ingestion
Ingestion Layer
Event volume metered per tenant here
→
Processing
Transformation & Processing
Batch/stream compute metered per job
→
Foundation
Unified Data Foundation
Storage consumption metered per zone/tenant
→
Intelligence
Usage & Billing
.NET Core metering service, Azure DB for PostgreSQL ledger
→
Activation
Chargeback Reports, Billing API
Consumed by finance and tenant admin tooling

💼 Business Context

  • Makes platform cost attributable per team or tenant, enabling internal chargeback instead of a single unattributed infrastructure line item
  • Is the metering foundation required before the platform could support external, multi-tenant billing
  • Owned by Platform Engineering / Finance

🔌 Technical Overview

A .NET Core metering service (Docker container on AKS) aggregates consumption signals emitted across the stack — event volume tagged per tenant at the Ingestion API, query compute time from the Query Optimizer, and storage bytes per zone from Azure Data Lake Storage Gen2 — into a usage ledger in Azure Database for PostgreSQL, rolled up nightly via a dbt model into marts.tenant_usage. A billing API exposes current-period usage and historical invoices to tenant-admin tooling and finance systems.

Metered Dimensions

Ingestion event volume Query compute time Storage bytes by zone API request count

💾 Usage Ledger Entry

{
  "tenant_id": "tenant_northwind",
  "period": "2026-07",
  "ingestion_events": 812_400_000,
  "query_compute_minutes": 4210,
  "storage_gb": 18_400,
  "estimated_cost_usd": 6240.18
}

🔗 Integration Points

  • Ingestion API — tags event volume per tenant at the point of ingestion
  • Query Optimizer — reports compute time per query for attribution
  • Azure Data Lake Storage Gen2 — source of per-zone, per-tenant storage bytes
  • Reverse ETL / CDP Sync — can push usage summaries into a finance system's native workflow

🧰 Services Consumed

  • Owning microservice — Cxos.Operations.Api (see the Full Application Service Map)
  • Database — Azure Database for PostgreSQL + Azure Cosmos DB Table API + Azure Data Explorer

⚠️ Non-Functional Considerations

  • Scale: metering aggregation runs as a nightly rollup, decoupled from real-time request paths so it never adds latency to ingestion or query traffic
  • Latency: usage figures are current as of the prior night's rollup; near-real-time usage is available at reduced precision from live counters for the current period
  • Reliability: the usage ledger is append-only and reconciled against raw metering events monthly, since billing figures must be auditable and disputable
  • Security/Privacy: usage records contain consumption metadata, not customer data, and are scoped so one tenant can never see another tenant's usage

🎯 Enterprise Example

Finance needs to allocate platform infrastructure cost across five internal business units. Usage & Billing's monthly ledger gives an auditable, per-unit breakdown of ingestion, compute, and storage consumption — replacing a rough headcount-based cost allocation that several teams disputed as unfair.

← Back to Operational Services