Skip to content

Cost Tracking #82

@v0l

Description

@v0l

Cost tracking should be optional but can be used to determine P/L.

Scope

DB changes

  • Add optional cost fields to ip_range:
    • cost_per_ip: monthly cost per IP address (smallest currency units)
    • cost_currency: currency code (e.g. USD, EUR)
  • Add optional cost fields to vm_host:
    • monthly_cost: recurring monthly cost of the host (rent/colo fee)
    • investment_cost: one-time capital cost (hardware purchase) for break-even calculation
    • cost_currency: currency code

Admin API

  • PATCH /api/v1/admin/ip-range/{id} — set cost_per_ip, cost_currency
  • PATCH /api/v1/admin/host/{id} — set monthly_cost, investment_cost, cost_currency

P/L calculation (to be specified in a follow-up issue)

  • Total monthly cost = sum of host monthly costs + (IPs assigned × cost_per_ip for each range)
  • Total monthly revenue = sum of active VM renewal amounts (already tracked in vm_payment)
  • Break-even tracking = investment_cost amortised against cumulative profit

Notes

  • All cost fields are optional — omitting them means no cost data for that resource (no behaviour change)
  • Currency conversion will be needed when costs and revenues are in different currencies — defer to follow-up
  • Cost data is admin-only; never exposed to end users

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions