Cost Allocation
The CostAllocationController and FinOpsCostController provide observability-specific cost tracking and allocation. This covers the cost of running observability infrastructure (Prometheus, Loki, Jaeger) and allocates those costs back to tenants based on their usage.
Cost Allocation Report
Endpoint: GET /api/v1/observability/costs/allocation
Returns the cost allocation breakdown for observability infrastructure.
CostAllocation Structure
| Field | Type | Description |
|---|---|---|
tenantId | String | Tenant identifier |
period | String | Billing period |
metricsCost | BigDecimal | Cost of metrics storage and queries |
logsCost | BigDecimal | Cost of log storage and queries |
tracesCost | BigDecimal | Cost of trace storage and queries |
totalCost | BigDecimal | Total observability cost |
breakdown | List | Per-service cost breakdown |
Cost Optimization
Endpoint: GET /api/v1/observability/costs/optimization
Returns optimization recommendations to reduce observability costs.
CostOptimization Structure
| Field | Type | Description |
|---|---|---|
recommendation | String | Description of the optimization |
currentCost | BigDecimal | Current cost |
projectedCost | BigDecimal | Cost after optimization |
savings | BigDecimal | Estimated savings |
effort | String | low, medium, high |
category | String | retention, sampling, aggregation, archival |
Common Optimizations
| Category | Recommendation | Typical Savings |
|---|---|---|
| Retention | Reduce metrics retention from 30d to 15d | 30-50% |
| Sampling | Enable trace sampling at 10% for low-priority services | 80-90% |
| Aggregation | Pre-aggregate high-cardinality metrics | 40-60% |
| Archival | Move old logs to cold storage | 60-80% |
| Deduplication | Remove duplicate metric series | 10-20% |
Cost Budgets
CostBudget Structure
| Field | Type | Description |
|---|---|---|
id | String | Budget identifier |
tenantId | String | Tenant |
monthlyBudget | BigDecimal | Monthly cost limit |
currentSpend | BigDecimal | Current month spend |
projectedSpend | BigDecimal | Projected month-end spend |
alertThresholds | List | Percentage thresholds for alerts (e.g., 80%, 90%, 100%) |
Cost Endpoints
| Method | Path | Description |
|---|---|---|
GET | /api/v1/observability/costs/allocation | Cost allocation report |
GET | /api/v1/observability/costs/optimization | Optimization recommendations |
GET | /api/v1/observability/costs/budgets | List cost budgets |
POST | /api/v1/observability/costs/budgets | Create cost budget |
GET | /api/v1/observability/costs/trends | Cost trend analysis |