Cost Dashboard
The CostDashboardController and CostDashboardService provide cost analytics and visualization data for tenant administrators. The dashboard aggregates billing data, usage trends, cost projections, and budget tracking into a unified view.
Dashboard Overview
Endpoint: GET /api/v1/billing/cost-dashboard/tenants/:tenantId/overview
Returns the main dashboard data including current month costs, month-over-month change, cost breakdown by category, and budget status.
curl http://localhost:8087/api/v1/billing/cost-dashboard/tenants/550e8400/overview \
-H "Authorization: Bearer ${TOKEN}"Cost Breakdown
Endpoint: GET /api/v1/billing/cost-dashboard/tenants/:tenantId/breakdown
Returns cost breakdown by metric type, cost center, and time period.
| Parameter | Type | Default | Description |
|---|---|---|---|
startDate | LocalDate | Start of current month | Analysis start date |
endDate | LocalDate | Today | Analysis end date |
groupBy | String | metricType | Grouping: metricType, costCenter, service |
Cost Trends
Endpoint: GET /api/v1/billing/cost-dashboard/tenants/:tenantId/trends
Returns historical cost data for trend analysis.
| Parameter | Type | Default | Description |
|---|---|---|---|
months | int | 6 | Number of months of history |
granularity | String | monthly | daily, weekly, monthly |
Cost Projections
Endpoint: GET /api/v1/billing/cost-dashboard/tenants/:tenantId/projections
Projects future costs based on current usage trends and growth patterns.
Budget Tracking
Endpoint: GET /api/v1/billing/cost-dashboard/tenants/:tenantId/budgets
Returns budget utilization data including:
- Allocated budget per cost center
- Current spend vs. budget
- Projected end-of-month spend
- Budget alerts (percentage of budget consumed)
Cloud Cost Integration
The CostIngestionService and CostIngestionController handle ingestion of cloud infrastructure costs from providers (Azure, AWS, GCP). These costs are combined with platform usage costs to provide a complete view of total cost of ownership.
Cloud Cost Entities
| Entity | Description |
|---|---|
CloudCost | Individual cloud cost records from provider billing |
CostIngestionJob | Tracks the status of cost data ingestion jobs |
CostAnomaly | Detected anomalies in cost patterns |
CostAlert | Cost threshold alerts |
Budget | Budget definitions and tracking |
Cost Anomaly Detection
The dashboard includes cost anomaly detection that identifies:
- Unexpected cost spikes (daily cost exceeds 2x the 30-day average)
- Unusual resource type costs
- Cost center budget breaches
- Unattributed costs