MATIH Platform is in active MVP development. Documentation reflects current implementation status.
8. Platform Services
Cost Allocation

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

FieldTypeDescription
tenantIdStringTenant identifier
periodStringBilling period
metricsCostBigDecimalCost of metrics storage and queries
logsCostBigDecimalCost of log storage and queries
tracesCostBigDecimalCost of trace storage and queries
totalCostBigDecimalTotal observability cost
breakdownListPer-service cost breakdown

Cost Optimization

Endpoint: GET /api/v1/observability/costs/optimization

Returns optimization recommendations to reduce observability costs.

CostOptimization Structure

FieldTypeDescription
recommendationStringDescription of the optimization
currentCostBigDecimalCurrent cost
projectedCostBigDecimalCost after optimization
savingsBigDecimalEstimated savings
effortStringlow, medium, high
categoryStringretention, sampling, aggregation, archival

Common Optimizations

CategoryRecommendationTypical Savings
RetentionReduce metrics retention from 30d to 15d30-50%
SamplingEnable trace sampling at 10% for low-priority services80-90%
AggregationPre-aggregate high-cardinality metrics40-60%
ArchivalMove old logs to cold storage60-80%
DeduplicationRemove duplicate metric series10-20%

Cost Budgets

CostBudget Structure

FieldTypeDescription
idStringBudget identifier
tenantIdStringTenant
monthlyBudgetBigDecimalMonthly cost limit
currentSpendBigDecimalCurrent month spend
projectedSpendBigDecimalProjected month-end spend
alertThresholdsListPercentage thresholds for alerts (e.g., 80%, 90%, 100%)

Cost Endpoints

MethodPathDescription
GET/api/v1/observability/costs/allocationCost allocation report
GET/api/v1/observability/costs/optimizationOptimization recommendations
GET/api/v1/observability/costs/budgetsList cost budgets
POST/api/v1/observability/costs/budgetsCreate cost budget
GET/api/v1/observability/costs/trendsCost trend analysis