Methodology

How Showback allocates infrastructure costs across applications using real-time resource usage data.

The Cost Model

App Cost = Droplet Share + Cloudflare Share + Domain Share

Droplet Share = (50% × CPU share + 50% × Memory share) × Droplet cost

Cloudflare Share = Network traffic share × Cloudflare cost

Domain Share = Domain cost ÷ Number of app groups

The result is the proportional cost allocated to each application based on its actual resource consumption.

Monthly Fixed Costs

Digital Ocean Droplet (2 vCPU, 4GB RAM, 80GB SSD) $24.00/mo
Cloudflare DNS (free tier) $0.00/mo
Domain Registration (dreamfold.dev, $12.20/year) $1.02/mo
Total $25.02/mo

Resource Measurement

All resource usage is measured live from Prometheus via cAdvisor, which collects per-container metrics from the Docker runtime.

CPU Usage: container_cpu_usage_seconds_total — total CPU-seconds consumed per container, summed over the measurement period.

Memory Usage: container_memory_usage_bytes — average memory in bytes per container over the measurement period.

Network Traffic: container_network_transmit_bytes_total + container_network_receive_bytes_total — total bytes transferred.

Measurement interval: every 15 minutes

Allocation weights: 50% CPU + 50% memory for droplet cost

Share Calculation

CPU share = app_cpu_seconds / total_cpu_seconds
Memory share = app_memory_bytes / total_memory_bytes
Network share = app_network_bytes / total_network_bytes
Resource share = 0.5 × CPU share + 0.5 × Memory share

Each app's share is the proportion of total resources it consumes relative to all other apps. When no usage data is available (e.g. on first startup), shares default to an even split across all app groups.

Application Boundaries

Each app's cost includes the resource usage of its constituent containers:

Equestrian Venue Manager: evm-backend, evm-frontend, evm-db
EquiCalendar: equicalendar
Planespotter: planespotter-api, planespotter-frontend, planespotter-sync, planespotter-db, planespotter-cache
dreamfold.dev: meweb
GreenScope: greenscope
Infrastructure: prometheus, grafana, loki, promtail, node-exporter, cadvisor, ntfy, showback

Domain Cost Allocation

The domain registration cost ($1.02/mo) is split evenly across all 6 application groups, since every app uses a dreamfold.dev subdomain (e.g. evm.dreamfold.dev, planespotter.dreamfold.dev). This gives each app $0.1700/mo in domain cost.

Limitations

  • Fixed cost model: The underlying costs (droplet, domain) are fixed monthly charges. Showback allocates them proportionally but cannot reduce the actual bill.
  • CPU + memory only: Disk I/O is not included in the allocation model, as cAdvisor disk metrics are less reliable for shared-disk environments.
  • Equal domain split: Domain cost is split evenly rather than by traffic, since all apps benefit equally from DNS resolution.
  • No data transfer costs: DigitalOcean includes generous transfer allowances. If transfer overages occur, they are not currently tracked.
  • Measurement interval: Calculations run every 15 minutes. Short-lived spikes within a period are averaged out.

Contact

Showback is built by Darryl Cauldwell. For questions about this methodology, please visit dreamfold.dev.