FinOps · Multi-tenant · SKU-level

💳 Billing & FinOps

Cost management theo project/VPC/SKU, budgets, alerts, subscription lifecycle, quota enforcement. Tương đương AWS Cost Explorer + Budgets, GCP Billing, Azure Cost Management.

Thành phần

Cost Management

costmgmt-service :8103 — usage records, breakdown SKU (CPU/RAM/Network/Storage), trend analysis.

Subscription

subscription-service — gói trả trước / trả sau, ràng buộc commit, auto-renew.

Quota

quota-service — limit per project (vCPU, RAM, IPs, storage GB), hard/soft, override admin.

Project Isolation

Mỗi team = 1 Project (kiểu GCP Project), bill độc lập theo X-Project-ID.

Budget & Alert

Budget tháng/quý + threshold (50/80/100%) gửi qua notification-service.

Per-VPC report

Cost breakdown theo VPC để trả lời câu hỏi “team nào đang tốn nhất”.

Báo cáo SKU-level

GET /api/v1/billing/cost?project_id=xxx&from=2026-01-01&to=2026-01-31
→ {
  "total_cost": 12345600,
  "currency": "VND",
  "usage_records": [
    { "sku":"compute.vcpu",   "total_quantity":1240, "average_unit_price":1500, "total_cost":1860000 },
    { "sku":"compute.ram_gb", "total_quantity":3200, "average_unit_price":300,  "total_cost":960000  },
    { "sku":"network.egress_gb", "total_quantity":150, "average_unit_price":1000, "total_cost":150000 },
    ...
  ]
}

Cô lập tài nguyên kiểu GCP Project

# Tạo project mới
POST /api/v1/projects { "name":"team-shipping", "billing_account_id":"..." }

# Mọi request gắn header
X-Project-ID: prj-team-shipping
→ resources, quotas, costs đều cô lập theo project

Budget & Alert

POST /api/v1/billing/budgets
{ "project_id":"prj-team-shipping",
  "amount":50000000, "currency":"VND",
  "period":"monthly",
  "alerts":[
    { "threshold_pct":50, "channels":["email","slack"] },
    { "threshold_pct":80, "channels":["email","slack","webhook"] },
    { "threshold_pct":100, "channels":["email","slack","sms"] }
  ]
}