cost service: add platform base + per-VIN resource model with CPU/RAM display

- Updated cost model to show: (Platform Base) + (Per-VIN × VINs)
- Platform base: 176 cores / 896GB RAM (Kafka, ClickHouse, MongoDB, Redis, PostgreSQL, gateway, monitoring)
- Per-VIN marginal: 50mc / 82MB per vehicle
- Added RESOURCE USAGE MODEL and COST FORMULA sections to report
- Added CPU (mc) and RAM (MB) columns to TOP COST VEHICLES table
- Updated README with new report output
- virtual-vehicle: documented Vault cert TTL error troubleshooting
This commit is contained in:
Chris Rai
2026-02-04 21:18:24 -05:00
parent 54b17cf126
commit c48ae896a4
5 changed files with 172 additions and 84 deletions

View File

@@ -220,6 +220,16 @@ func GetReport(w http.ResponseWriter, r *http.Request) {
║ On-Prem Cost: $%.2f
║ Savings: $%.2f (%.1f%%)
╠══════════════════════════════════════════════════════════════════╣
║ RESOURCE USAGE MODEL ║
║ ─────────────────────────────────────────────────────────────── ║
║ Platform Base: %.0f cores / %.0f GB RAM (fixed)
║ Per-VIN Marginal: %.0f millicores / %.0f MB RAM
║ Total Fleet: %.1f cores / %.1f GB RAM
╠══════════════════════════════════════════════════════════════════╣
║ COST FORMULA ║
║ ─────────────────────────────────────────────────────────────── ║
║ (Platform Base) + (Per-VIN × %d VINs) + Managed Services
╠══════════════════════════════════════════════════════════════════╣
║ COST RATES ║
║ ─────────────────────────────────────────────────────────────── ║
║ Cloud: CPU $%.2f/core-hr Memory $%.3f/GB-hr
@@ -237,12 +247,20 @@ func GetReport(w http.ResponseWriter, r *http.Request) {
annualOnprem := summary.TotalOnpremCost * 12
annualSavings := annualCloud - annualOnprem
// Calculate total fleet resources
totalCPU := services.PlatformBaseCPUCores + (services.PerVinCPUCores * float64(summary.VehicleCount))
totalRAM := services.PlatformBaseMemoryGB + (services.PerVinMemoryGB * float64(summary.VehicleCount))
fmt.Fprintf(w, report,
from.Format("2006-01-02"), to.Format("2006-01-02"),
summary.VehicleCount,
summary.TotalCloudCost,
summary.TotalOnpremCost,
summary.TotalSavings, summary.SavingsPercent,
services.PlatformBaseCPUCores, services.PlatformBaseMemoryGB,
services.PerVinCPUCores*1000, services.PerVinMemoryGB*1024,
totalCPU, totalRAM,
summary.VehicleCount,
services.CloudCPUPerCoreHour, services.CloudMemoryPerGBHour,
services.OnpremCPUPerCoreHour, services.OnpremMemoryPerGBHour,
services.BaseInfraCloudCost, services.BaseInfraOnpremCost,
@@ -252,11 +270,11 @@ func GetReport(w http.ResponseWriter, r *http.Request) {
// Add top cost VINs if any
if len(summary.TopCostVins) > 0 {
fmt.Fprintf(w, "\nTOP COST VEHICLES:\n")
fmt.Fprintf(w, "%-20s %12s %12s %10s\n", "VIN", "Cloud $", "On-Prem $", "Savings %")
fmt.Fprintf(w, "%-20s %12s %12s %10s\n", "───────────────────", "──────────", "──────────", "────────")
fmt.Fprintf(w, "%-20s %10s %10s %12s %12s %10s\n", "VIN", "CPU (mc)", "RAM (MB)", "Cloud $", "On-Prem $", "Savings %")
fmt.Fprintf(w, "%-20s %10s %10s %12s %12s %10s\n", "───────────────────", "────────", "────────", "──────────", "──────────", "────────")
for _, v := range summary.TopCostVins {
fmt.Fprintf(w, "%-20s %12.2f %12.2f %9.1f%%\n",
truncateVIN(v.VIN), v.TotalCloudCost, v.TotalOnpremCost, v.SavingsPercent)
fmt.Fprintf(w, "%-20s %10.0f %10.0f %12.2f %12.2f %9.1f%%\n",
truncateVIN(v.VIN), v.AvgCPUCores*1000, v.AvgMemoryGB*1024, v.TotalCloudCost, v.TotalOnpremCost, v.SavingsPercent)
}
}
}