cloud/bmaas: implement webug
Webug (pronounced: /wɛbʌɡ/, not /wiːbʌɡ/) is a web debug interface for
BMDB, inspired by the great web debug interfaces of old.
It uses the new BMDB reflection API to access most
machine/tag/work/backoff information, plus sqlc queries to access
session information.
Change-Id: If0e65b6fc33ad92baef9c6d98333f90a02efa1b3
Reviewed-on: https://review.monogon.dev/c/monogon/+/1132
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/cloud/bmaas/bmdb/model/queries_base.sql b/cloud/bmaas/bmdb/model/queries_base.sql
index 8257fb8..4119f94 100644
--- a/cloud/bmaas/bmdb/model/queries_base.sql
+++ b/cloud/bmaas/bmdb/model/queries_base.sql
@@ -67,4 +67,10 @@
SELECT *
FROM work_history
WHERE machine_id = $1
-ORDER BY timestamp ASC;
\ No newline at end of file
+ORDER BY timestamp ASC;
+
+-- name: GetSession :many
+-- Retrieve session information by session ID.
+SELECT *
+FROM sessions
+WHERE session_id = $1;
\ No newline at end of file