cloud/bmaas/bmdb/scruffy: initialize, implement BMDB metrics
This creates a new BMaaS component, Scruffy the Janitor.
Scruffy will run a bunch of housekeeping jobs that aren't tied to a
particular provider or even region. Currently Scruffy just collects BMDB
metrics by periodically polling the BMDB SQL database.
Change-Id: Icafa714811757eaaf31fed43184ded8512bde067
Reviewed-on: https://review.monogon.dev/c/monogon/+/1819
Tested-by: Jenkins CI
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
diff --git a/cloud/bmaas/bmdb/model/queries_workflows.sql b/cloud/bmaas/bmdb/model/queries_workflows.sql
index 62e4a40..854c15d 100644
--- a/cloud/bmaas/bmdb/model/queries_workflows.sql
+++ b/cloud/bmaas/bmdb/model/queries_workflows.sql
@@ -8,6 +8,7 @@
-- name: GetMachinesForAgentStart :many
-- Get machines that need agent started for the first time. Machine can be
-- assumed to be 'new', with no previous attempts or failures.
+-- ONCHANGE(queries_stats.sql): constraints must be kept in sync with StatsMachinesForAgentStart.
SELECT
machine_provided.*
FROM machines
@@ -34,6 +35,7 @@
-- some point, or the machine got rebooted or somehow else lost the agent. Assume
-- some work needs to be performed on the shepherd side to diagnose and recover
-- whatever state the machine truly is in.
+-- ONCHANGE(queries_stats.sql): constraints must be kept in sync with StatsMachinesForAgentRecovery.
SELECT
machine_provided.*
FROM machines