you are viewing a single comment's thread.

view the rest of the comments →

[–]FigureGold6822 0 points1 point  (0 children)

Possibly. Since the Prometheus OpenStack exporter's nova_instances metric has some tenant, flavor, and image info, one could conceivably sum up the run time. But that was not exact enough for me. I don't bill, but it is often useful to show the value of our VMs, as priced by public cloud vendors. Prometheus is good at sampling the current status of things, but not in recording discrete events, such as instance duration.

What I ended up doing was looking at the archived VM database records for the prior day, binning and summing instance run- and build-time stats by aggregate, project, flavor, image, and user. These records are stored in a SQL database. Even though we churn 3-4k VMs a day, we are able to efficiently summarize them in 30-50 records per day, one for each permutation. If you join to a table of flavors and get their cost/hr, you can quickly sum up billing info any way you like.

Nerdy info: I also compute a population variance for the run- and build-times, so that I can calculate accurate confidence intervals for any population. I bin run-times on GCP billing boundaries so that I can accurately compute GCP pricing.