Skip to content

Grafana dashboards (platform ops) ​

Internal Grafana on the ops VPS (Infinity datasource) reads platform Pages APIs behind Cloudflare Access. JSON lives in social/grafana/; regenerate with the build scripts, then import or rely on file provisioning.

Related: social/grafana/README.md · platform admin · platform apply checklist · platform billing · account plans Stripe

Dashboards ​

DashboardUIDAPIImport JSON
Lovely Home — Social Insightslovely-home-social-insightsGET /api/platform/social-insightslovely-home-social-insights-dashboard.json
Lovely Home — Stripe Billinglovely-home-stripe-billingsame URL → billing blocklovely-home-stripe-billing-dashboard.json
Lovely Home — AI usagelovely-home-ai-usageGET /api/platform/ai-usagelovely-home-ai-usage-dashboard.json
Lovely Home — Cloudflare Billinglovely-home-cloudflare-billingGET /api/platform/cloudflare-billinglovely-home-cloudflare-billing-dashboard.json
Lovely Home — E2E lifecyclelovely-home-e2e-lifecycleGET /api/platform/e2e-lifecycle-runslovely-home-e2e-lifecycle-dashboard.json
Lovely Home — Signup funnellovely-home-signup-funnelGET /api/platform/signup-funnellovely-home-signup-funnel-dashboard.json
Lovely Home — Website visitorslovely-home-website-visitorsGET /api/platform/social-insights?view=website-visitorslovely-home-website-visitors-dashboard.json
Lovely Home — CI runner queuelovely-home-ci-runner-queueGET /api/platform/ci-runner-queuelovely-home-ci-runner-queue-dashboard.json
Lovely Home — GitHub Actions usagelovely-home-github-actions-usageGET /api/platform/github-actions-usagelovely-home-github-actions-usage-dashboard.json

Same Infinity datasource for all nine: base URL is the platform hostname; custom headers:

  • X-Lovely-Client-Id (value: the service token client ID)
  • X-Lovely-Client-Secret (value: the service token client secret)

Not CF-Access-Client-Id / CF-Access-Client-Secret: Cloudflare removes those two before the request reaches the platform, so the API answers 401 to the right token (#1562).

Values come from Terraform outputs social_insights_service_token_client_id / social_insights_service_token_client_secret (also set as SOCIAL_INSIGHTS_CF_ACCESS_* on platform Pages).

Access + Pages middleware (required for Grafana) ​

Grafana uses service-token headers, not operator OTP. Two layers must allow the path:

  1. Zero Trust Access bypass apps (Terraform platform_admin):
    • platform.lovely-home.co.uk/api/platform/social-insights
    • platform.lovely-home.co.uk/api/platform/ai-usage
    • platform.lovely-home.co.uk/api/platform/cloudflare-billing
    • platform.lovely-home.co.uk/api/platform/e2e-lifecycle-runs
    • platform.lovely-home.co.uk/api/platform/signup-funnel
    • platform.lovely-home.co.uk/api/platform/ci-runner-queue
    • platform.lovely-home.co.uk/api/platform/github-actions-usage
  2. Pages Access middleware skip in functions/lib/platformAccessBypass.js for the same paths (and Stripe webhook / public signup as documented elsewhere).

Then the Function validates the service-token headers (app 401 if missing/wrong).

Symptoms ​

SymptomLikely cause
Every panel No data; curl to the API returns Access 302 loginMissing Zero Trust bypass or missing Pages middleware bypass
App 401 UNAUTHORIZED without headers, 200 with Infinity headersAuth OK — check date range, secrets, or provider ok / message in JSON
Workers AI empty, OpenAI NOT_CONFIGUREDSet PLATFORM_OPENAI_ADMIN_KEY (see below); Workers AI needs Account Analytics Read on PLATFORM_CF_API_TOKEN
Panels were fine, then empty after TerraformPages env replaced — run Platform apply checklist before the next apply
Every panel 504 context deadline exceeded (Client.Timeout exceeded while awaiting headers), but curl from the VPS gets a fast 401Grafana's container has lost outbound networking. It runs under snap Docker, and the regular Docker (invoice app) rewrites iptables when it recreates containers. Run sudo snap restart docker, and move Grafana to the regular Docker (below) so it doesn't recur. To confirm first: sudo nsenter -t $(pgrep -f 'grafana server' | head -1) -n curl -sS -o /dev/null -w '%{http_code}\n' --max-time 15 --resolve platform.lovely-home.co.uk:443:{IP} https://platform.lovely-home.co.uk/api/platform/signup-funnel. A timeout means traffic is blocked; 401 means it's fine. (#1000; permanent fix #1001)

After changing Access apps: terraform apply for platform_admin. After changing platformAccessBypass.js: merge to main and wait for home-dashboard-platform production deploy (no Terraform).

Access service token (Grafana Infinity headers) ​

Terraform creates one Grafana social insights Access service token (duration = 8760h, ~1 year). The same client ID and secret, sent as X-Lovely-Client-Id / X-Lovely-Client-Secret, work for all seven Infinity-backed APIs above (including E2E lifecycle POST from CI).

You only need to refresh Infinity when:

  • Terraform creates or replaces that token (first-time apply, import recovery, or manual destroy in Zero Trust) — sync from terraform output and update Infinity; Pages env vars update on the next successful platform_admin apply + deploy.
  • The token expires (~annually) — rare if Terraform keeps managing it.

Routine platform deploys and dashboard JSON changes do not rotate the token.

Social Insights ​

Meta Instagram/Facebook metrics from D1 (SOCIAL_INSIGHTS_DB) plus Cloudflare website zone traffic (website block).

  • Collect workflow: social/META_INSIGHTS.md (.github/workflows/social-insights.yml, every 3 hours). After API or dashboard JSON changes, redeploy platform admin (Pages) and git pull on the Grafana VPS (or re-import JSON). Re-run Social — collect Meta insights once so D1 picks up corrected Instagram views.
  • Website GraphQL needs PLATFORM_CF_ZONE_ID + PLATFORM_CF_API_TOKEN
  • Workers AI and Claude are not on this dashboard anymore — use AI usage (Claude moved from claudeUsage here to claude on ai-usage)

Regenerate:

bash
GRAFANA_INFINITY_UID=cfzakgwkklxc0a node social/grafana/build-dashboard.mjs

Stripe Billing ​

Uses billing on social-insights (live Stripe, non-PII). See platform-billing.md.

bash
GRAFANA_INFINITY_UID=cfzakgwkklxc0a node social/grafana/build-billing-dashboard.mjs

AI usage (Workers AI + OpenAI + Claude D1) ​

Endpoint: https://platform.lovely-home.co.uk/api/platform/ai-usage?from=YYYY-MM-DD&to=YYYY-MM-DD

With no dates it covers the last 7 days. ?period=month gives month-to-date instead (1st of the UTC month to today), which the cost alerts use (#1028).

ProviderDataConfig
Workers AINeurons (est.), tokens, requests, billable USD after 10k free neurons/day @ $0.011/1k neurons; daily + running totalPLATFORM_CF_API_TOKEN with Account → Analytics → Read (and account id). GraphQL retention ~31 days — longer Grafana ranges are clamped server-side. Query uses datetime_gt / datetime_lt on aiInferenceAdaptiveGroups; when to is the current UTC day the upper bound is capped to now (endCappedToNow) so Cloudflare does not see a future end time. Same-day buckets may lag ~1h. Dashboard panel Workers AI API status shows ok, message, rangeClamped.
OpenAICompletions usage + organization costs (daily + running total)PLATFORM_OPENAI_ADMIN_KEY — OpenAI Organization Admin key (Admin keys), not a project sk- key. Terraform: platform_openai_admin_key → Pages secret.
ClaudeSocial automation usage from D1 (claude_usage), same data as former Social Insights claudeUsageSOCIAL_INSIGHTS_DB on platform Pages. Costs are estimates from social/claude-pricing.mjs, not Anthropic invoices. Rolling today/7d/30d windows and the calendar month to date (this_month, used by the cost alert and the Est. cost this month tile, #1442) use UTC.

Auth (three layers): Grafana Infinity X-Lovely-Client-Id/Secret (Terraform social_insights_service_token_* → Pages SOCIAL_INSIGHTS_CF_ACCESS_*) must match or the API returns 401 before any provider logic runs. That is not the same as PLATFORM_CF_API_TOKEN or PLATFORM_OPENAI_ADMIN_KEY. Check Pages slots: bash scripts/verify-platform-ai-usage-pages-env.sh. Probe the live endpoint: bash scripts/verify-grafana-platform-api.sh (pass GRAFANA_CF_ACCESS_CLIENT_ID / GRAFANA_CF_ACCESS_CLIENT_SECRET or use terraform outputs).

Regenerate:

bash
GRAFANA_INFINITY_UID=cfzakgwkklxc0a node social/grafana/build-ai-usage-dashboard.mjs

Cloudflare Billing (account billable usage) ​

Endpoint: GET /api/platform/cloudflare-billing?from=&to=

BlockSource
Billable productsCloudflare Billable Usage API (invoice line items for the date range)
Workers requestsGraphQL workersInvocationsAdaptive (by script). When to is the current UTC day, datetime_leq is capped to now (endCappedToNow) instead of end-of-day.
Workers AISame neurons / billable USD estimate as AI usage (fetchWorkersAiUsageForInsights / workersAiGraphqlTimeBounds).
Storage & inventoryR2 + hub D1 bytes, D1/R2/Workers/Pages counts

Grafana panels Billable Usage API, Workers invocations, and Workers AI (top row) mirror the AI usage Workers AI API status table: check ok, message, and endCappedToNow when KPIs are zero.

Billable Usage API lag: invoice line items often trail live analytics by about one day; same-day product costs may stay at zero until Cloudflare publishes daily billable rows.

Requires PLATFORM_CF_API_TOKEN with Account → Billing → Read and Account → Analytics → Read on platform Pages.

Regenerate:

bash
GRAFANA_INFINITY_UID=cfzakgwkklxc0a node social/grafana/build-cloudflare-billing-dashboard.mjs

E2E lifecycle ​

Hub lifecycle E2E history from D1 (e2e_lifecycle_runs on SOCIAL_INSIGHTS_DB). CI POSTs after each run; see e2e-reporting.md.

Regenerate:

bash
GRAFANA_INFINITY_UID=cfzakgwkklxc0a node social/grafana/build-e2e-lifecycle-dashboard.mjs

Import / refresh ​

  1. Grafana → Dashboards → New → Import → upload the JSON from social/grafana/
  2. Map Infinity when prompted; overwrite if the UID already exists
  3. Or on the VPS: git pull so social/grafana/provisioned/ updates (file provider ~30s)

Do not put secrets in dashboard JSON — only on Infinity and platform Pages.

Troubleshooting — AI usage panels No data ​

A few panels empty, others fine, recovers on refresh (#1049). Every panel makes its own API request. ai-usage and cloudflare-billing now share one provider fetch between concurrent panel requests for the same date range, and keep a healthy result for 60 s, so one page load calls OpenAI and Cloudflare once instead of about 17 times. OpenAI 429 and 5xx responses are retried once. A response's X-Platform-Cache header shows miss, shared or hit. Payloads with a failing provider are never cached, and figures can be up to a minute old.

  1. Run bash scripts/verify-grafana-platform-api.sh (from repo root, with CLOUDFLARE_API_TOKEN for the Pages check). For the live probe, export the same credentials Grafana Infinity uses:
    • GRAFANA_CF_ACCESS_CLIENT_ID / GRAFANA_CF_ACCESS_CLIENT_SECRET, or
    • cd terraform && terraform output -raw social_insights_service_token_client_id (and _client_secret).
  2. Interpret the result:
Probe resultFix
401 UNAUTHORIZEDInfinity headers are stale or wrong — copy current values from terraform output into the Infinity datasource (must match Pages SOCIAL_INSIGHTS_CF_ACCESS_*).
503 SOCIAL_INSIGHTS_AUTH_NOT_CONFIGUREDPages missing service token env — run Platform admin Terraform (apply-platform-admin).
HTTP 200 but Grafana still emptyInspect JSON workersAi.ok / openai.ok and message — provider keys may be missing (verify-platform-ai-usage-pages-env.sh) or date range has no usage.
302 / HTML login on curlMissing Zero Trust bypass or Pages middleware skip — see Access + Pages middleware above.

Right token, still 401 (#1562). First check the header names. On 2026-11-11 every panel went empty because Cloudflare's edge began removing CF-Access-Client-Id and CF-Access-Client-Secret before the request reached the platform; the stored token was fine. A live log tail of the production deployment (wrangler pages deployment tail <deployment id> --project-name home-dashboard-platform --format json) shows which headers arrive. The token now travels as X-Lovely-Client-Id / X-Lovely-Client-Secret.

Stored secret out of step (#1005). If the header names are right and the probe, Grafana or a CI POST (E2E lifecycle, CI runner queue) still gets 401 with the right ed8df… ID, the secret stored on platform Pages may not match production Terraform state. A Terraform apply won't fix that, because Cloudflare doesn't return secret values, so no diff shows. Production state is the source of truth:

  1. Run the Platform refresh Grafana token Action (confirm=refresh-grafana-token). It reads the token from production state (no apply), writes SOCIAL_INSIGHTS_CF_ACCESS_CLIENT_ID and _SECRET whole onto home-dashboard-platform production in one PATCH (scripts/set-platform-pages-grafana-token.mjs), retries the production deployment and waits until the live API answers 200 to the token (scripts/verify-platform-grafana-token-live.mjs). When it passes it posts a one-line note to Slack #workflows.
  2. Grafana and the GitHub copies (E2E_LIFECYCLE_CF_ACCESS_*) need no change when they already hold the state value: the hourly CI runner queue metrics run logging jobs pushed proves the GitHub copy. Only if Grafana still gets 401 after step 1, reset X-Lovely-Client-Secret on the Infinity data source from terraform output; if CI still gets 401, run node scripts/sync-e2e-lifecycle-github-secrets.mjs.

Grafana's Save & test on the Infinity data source stays green with a wrong secret; trust a dashboard panel or the probe, not that button.

  1. verify-platform-ai-usage-pages-env.sh passing only proves PLATFORM_CF_API_TOKEN + PLATFORM_OPENAI_ADMIN_KEY slots exist — it does not prove Grafana can authenticate. Always run the Grafana verify script when panels go red.

Sanity check (AI usage, manual curl) ​

bash
curl -sS \
  -H "X-Lovely-Client-Id: …" \
  -H "X-Lovely-Client-Secret: …" \
  "https://platform.lovely-home.co.uk/api/platform/ai-usage?from=$(date -v-7d +%Y-%m-%d 2>/dev/null || date -d '7 days ago' +%Y-%m-%d)&to=$(date +%Y-%m-%d)" \
  | jq '{generatedAt, workersAi: {ok: .workersAi.ok, endCappedToNow: .workersAi.endCappedToNow, message: .workersAi.message}, openai: {ok: .openai.ok, error: .openai.error}, claude: {ok: .claude.ok, message: .claude.message}}'

Expect generatedAt set, workersAi: true when Analytics Read is configured.

Running Grafana on the VPS (one Docker only, #1001) ​

Grafana used to run under snap Docker while everything else on the VPS (invoice app, cloudflared) ran under the regular apt Docker. Two daemons on one host fight over iptables and the docker0 bridge. When one recreates containers, the other's containers can lose outbound networking. That caused the 19 Oct 2026 outage, where every panel showed 504 (#1000).

scripts/vps/migrate-grafana-off-snap-docker.sh moves Grafana to the regular Docker. It rebuilds Grafana from the snap container's own docker inspect, so the image, ports, mounts, user and settings stay the same. Secrets from the container's environment go to /opt/grafana/grafana.env (mode 600), never into the compose file or the repo. On the VPS, from the repo checkout:

bash
sudo bash scripts/vps/migrate-grafana-off-snap-docker.sh plan         # read-only: shows both Dockers + the generated compose
sudo bash scripts/vps/migrate-grafana-off-snap-docker.sh migrate      # back up, stop the old container (kept), start the new one, verify
#   … check the dashboards in the browser …
sudo bash scripts/vps/migrate-grafana-off-snap-docker.sh retire-snap  # disable snap Docker (data kept), restart Docker once
  • migrate backs up every mount to /opt/grafana/backup-{time}/, copies named volumes into the regular Docker, and starts /opt/grafana/docker-compose.yml. It then checks /api/health and that Grafana's container reaches the platform (expects 401).
  • Shared socket. If both daemons listen on /var/run/docker.sock, both CLIs reach whichever daemon started last. The script compares daemon IDs and stops if both CLIs reach the same one. Find each socket with sudo ss -xlp | grep docker, then rerun with SNAP_DOCKER_HOST=unix://… TARGET_DOCKER_HOST=unix://….
  • Snap Docker took over docker.sock (the VPS on 20 Oct 2026). sudo ss -xlp | grep docker.sock shows the apt dockerd on an orphaned /run/docker.sock and the snap dockerd on a newer socket at /var/run/docker.sock, which is the same path. Every docker command then reaches snap Docker, and the apt daemon (invoice app) keeps running but can't be reached. plan has already saved what's needed, so:
    bash
    sudo snap stop --disable docker                 # Grafana stops; its data stays on disk
    sudo systemctl restart docker.socket docker     # apt Docker owns the socket again (invoice app blips)
    sudo docker ps                                  # should list the invoice app containers
    sudo bash scripts/vps/migrate-grafana-off-snap-docker.sh adopt
    adopt uses the saved plan, backs up the data volume from its directory, copies it into the regular Docker, starts Grafana and verifies it. No retire-snap is needed afterwards.
  • rollback at any point stops the new Grafana and starts the old snap container again.
  • retire-snap refuses while snap Docker still has other containers. It runs systemctl restart docker so the regular Docker owns the firewall rules again; the invoice app restarts for a few seconds. After a quiet week: sudo snap remove --purge docker.

Afterwards Grafana is managed with sudo docker compose -f /opt/grafana/docker-compose.yml … like everything else, and the 504 symptom in the table above shouldn't come back.

Grafana version and compose file (#1030) ​

Grafana's compose file lives in the repo: ops/grafana/docker-compose.yml, pinned to grafana/grafana:13.2.4. Its mounts are relative to the checkout (dashboards, provisioned JSON, alerting). Secrets stay on the VPS in /opt/grafana/grafana.env (mode 600; template: ops/grafana/grafana.env.example).

bash
cd ~/home-dashboard && git pull
sudo docker compose -f ops/grafana/docker-compose.yml up -d     # same project "grafana", same volume and port

This replaces /opt/grafana/docker-compose.yml from the migration; delete that file once the repo one is running. Keeping current: Dependabot (docker-compose ecosystem, Sundays 04:00 UK) opens a PR when a new Grafana is released. Read the release notes, merge, then run the two commands above on the VPS. A major version (14.x) can change dashboards or alerting, so take a backup first: sudo tar -C /var/lib/docker/volumes/grafana_grafana-data/_data -czf ~/grafana-$(date +%F).tgz .

Cost alerts (#1028) ​

Provisioned from social/grafana/provisioning/alerting/ (generated by GRAFANA_INFINITY_UID=cfzakgwkklxc0a node social/grafana/build-cost-alerts.mjs). The rules are evaluated hourly in the Lovely Home folder:

AlertFires whenSource
Cloudflare bill over $10 this monthsummary.totalCost > 10GET /api/platform/cloudflare-billing (current month; Billable Usage API lags ~1 day)
Workers AI over $10 this monthworkersAi.summary.costUsd > 10GET /api/platform/ai-usage?period=month
OpenAI over $10 this monthopenai.summary.costUsd > 10same; no data yet counts as OK
Claude over $15 this monthestimated_cost_usd of claude.summaryRows[period="this_month"] (1st of the UTC month to today, #1442) > 15GET /api/platform/ai-usage
GitHub Actions minutes over 75% / 90% of the free allowancesummary.percentOfIncluded > 75 / > 90GET /api/platform/github-actions-usage (month to date)
GitHub Actions is charging this monthsummary.billedUsd > 0same

Delivery: contact point Lovely Home ops, which sends email through Resend's SMTP and posts to Slack. One notification goes out when an alert fires, then a daily reminder while it stays over, then a resolved message. A failing API keeps the last state, so an outage doesn't page you. Set these in /opt/grafana/grafana.env, then run sudo docker compose -f ops/grafana/docker-compose.yml up -d:

VariableValue
GF_SMTP_ENABLED, GF_SMTP_HOST, GF_SMTP_USER, GF_SMTP_FROM_ADDRESS, GF_SMTP_FROM_NAME, GF_SMTP_STARTTLS_POLICYas in grafana.env.example (smtp.resend.com:587, user resend)
GF_SMTP_PASSWORDa Resend API key. A separate sending-only key for Grafana is best, so it can be revoked on its own.
ALERT_EMAIL_TOwhere alert emails go
SLACK_ALERT_WEBHOOK_URLa Slack incoming-webhook URL for the alerts channel

What an alert says (#1314): each rule carries four annotations, and the contact point's email and Slack settings (SUBJECT_TEMPLATE / MESSAGE_TEMPLATE in the builder) turn them into the message. The wording sits inline in the contact point, not in a named notification template: Grafana's notifier only loads provisioned templates about a minute after start, and an email sent before then had an empty subject that Resend rejected (#1316). templates.json only deletes the old lovely-home template.

  • summary: what happened, with the number (for example "Claude has cost about $15.75 this month. The alert level is $15."). The resolved message reuses it, so it states the figure rather than "over the limit".
  • why: why it matters. action: what to do. where: which Grafana dashboard to open.

The subject is "Lovely Home alert: {title}" while firing and "Back to normal: {title}" when resolved. Raw query values (A=15.75 B=1) and labels are no longer shown.

Test delivery: Alerting → Contact points → Lovely Home ops → Test. Edit the builder, not the JSON. Grafana expands $VAR in provisioning files except rule annotations, which it stores raw. So the builder writes literal dollars as $$ everywhere else (a $10 title would otherwise render 0) and leaves annotations alone, where $values must reach the template engine. Escaping annotations too is what made alerts show $${{ printf … $$values.A.Value }} until #1314. The subject and message contain no $ at all.

After changing alerts: on the VPS, git pull in ~/home-dashboard, then sudo docker compose -f ops/grafana/docker-compose.yml restart grafana (alerting provisioning is read at start-up). Grafana keeps a provisioned rule that is simply dropped from the file, so a removed or renamed rule's old uid goes in RETIRED_RULE_UIDS in the builder, which writes it to deleteRules (#1442 retired lh-cost-claude-30d).

File provisioning (VPS) ​

Provider: social/grafana/provisioning/dashboards/dashboards.yml (disableDeletion: true, updateIntervalSeconds: 30).

Mount:

  • social/grafana/provisioning/dashboards → /etc/grafana/provisioning/dashboards
  • social/grafana/provisioned → /var/lib/grafana/dashboards

After changing dashboards.yml, restart Grafana. Prefer Import for one-off refreshes if Git sync is not mounted.

Platform CD note ​

Cloudflare Pages Platform CD does not update Grafana. After API or JSON changes: deploy platform Pages (for Functions), then re-import or pull provisioned JSON on the VPS.

Website visitors ​

Endpoint: GET /api/platform/social-insights?view=website-visitors&from=YYYY-MM-DD&to=YYYY-MM-DD · dashboard lovely-home-website-visitors (build: GRAFANA_INFINITY_UID=… node social/grafana/build-website-visitors-dashboard.mjs) · #1583.

It is a view of the social-insights path on purpose: that path already has the Grafana Zero Trust bypass and the Pages middleware skip, so no new Access app (Terraform) is needed. Without view the endpoint answers exactly as before.

  • Source: Cloudflare Web Analytics (the cookie-free beacon on every marketing page), account GraphQL dataset rumPageloadEventsAdaptiveGroups, filtered to requestHost = lovely-home.co.uk (override with WEBSITE_ANALYTICS_HOSTNAME) and bot = 0. Only real browsers count, so API calls, hub traffic, images and bots are left out. Code: functions/api/platform/platformWebsiteVisitors.js.
  • Needs CLOUDFLARE_ACCOUNT_ID and PLATFORM_CF_API_TOKEN with Account → Analytics → Read (already set for AI usage). No zone id.
  • Visitors = Cloudflare visits (a page view whose referrer is not this site). The site has no cookies, so there is no exact unique-people count. A visit belongs to the page it started on: per page, Visits started here is the landing count.
  • Pages add the 13 language URLs together (/fr/pricing → /pricing, using splitMarketingLanguagePath); the collapsed More detail row lists every URL.
  • Referrers get friendly names (Google, Facebook, Instagram, ChatGPT …); in-site navigation is dropped.
  • Sign-ups come from getSignupFunnel for the same range (same test-hub exclusions). Sign-ups per landing page are not possible: sign-up records do not store the landing page.
  • Long ranges are split by the dataset's maxDuration (read from settings, 7 days if unknown); ranges older than Cloudflare keeps (notOlderThan) are clipped and Data status says so.
  • Responses are shared for 60 s per range (withShortCache), so one dashboard load makes one Cloudflare read.
  • Empty panels: open More detail → Data status. It shows Cloudflare's own error, e.g. a missing permission.

Signup funnel ​

Endpoint: GET /api/platform/signup-funnel?from=YYYY-MM-DD&to=YYYY-MM-DD · dashboard lovely-home-signup-funnel (build: GRAFANA_INFINITY_UID=… node social/grafana/build-signup-funnel-dashboard.mjs).

Reads platform billing D1 only — no emails in the response. Excluded from every stage:

  • lifecycle e2e-* hubs;
  • every home of an internal test account (#1210). INTERNAL_TEST_SITE_IDS in functions/api/platform/platformSignupFunnel.js lists the hubs (today multi, Mark's Multi Home test on multi.lovely-hub.com); the funnel finds their owner in site_billing / account_homes and drops all of that owner's homes. Owner emails are only compared inside SQL, never returned.
StageSource
Signup submittedsignup_attribution row written when a valid signup reserves its hub name (migration 0022_signup_attribution.sql)
Hub createdsite_billing.created_at in range (Free at signup; Plus after Checkout)
Build started / failedprovision_dispatched_at / provision_last_error
Lovely Home+ / Multiplan_tier = 'plus' or an account plan
Still activestatus in active, trialing

Campaigns. The marketing site copies utm_source, utm_medium, utm_campaign, utm_content and the landing path (lp) from the landing URL onto internal links (URL only — no cookies or storage), and /signup posts them as attribution. Untagged visits show as (direct).

Use case. /signup has an optional What’s it for? picker (house_sitting, pet_sitting, holiday_let, family, carers, house_share, just_me), pre-selected from ?use= or the sitter landing pages. It is stored in signup_attribution.use_case (migration 0023_signup_use_case.sql) and shown in the Signups by use case panels. The hub setup wizard reads it via GET /api/public/hub-signup-use-case (hub Origin CORS, like hub-trial-status) and pre-selects the matching hub use case — and therefore starter guide — when the owner has not saved one yet.

Free signups are not in Stripe, so the Stripe dashboard stays empty for them; use this one.

Rollout: apply migration 0022 (node scripts/apply-platform-billing-migration.mjs), merge for the Pages bypass, terraform apply platform_admin for the Access bypass app, then git pull on the VPS (provisioned JSON) or import the dashboard JSON.

CI runner queue (#998) ​

How long GitHub Actions jobs waited for a runner (job created → started), per pool: the lovely-home VPS, ubuntu-latest, and ubuntu-24.04 on the public orchestrator. The target from #847 is a self-hosted p95 under 10 min at signup peaks.

PieceWhere
Collector.github/workflows/ci-runner-queue-metrics.yml, hourly at :23 on lovely-home. It runs scripts/push-runner-queue-metrics.mjs over the last 3 h of runs in home-dashboard and lovely-hub-provision.
Storeci_runner_queue_jobs on SOCIAL_INSIGHTS_DB (migration social/migrations/0017), upserted by job id and pruned after 90 days
APIGET /api/platform/ci-runner-queue?from=&to= returns pools (p50/p95/max/over_target), hourlySeries, slowestJobs and lastIngestAt. The collector uses POST on the same path.
AuthSame service token. The workflow uses the E2E_LIFECYCLE_CF_ACCESS_* repo secrets.

Rollout:

  1. Apply the social migration: Social — apply D1 migrations workflow, or npm run social:migrate.
  2. Deploy platform Pages, then run Platform admin Terraform (Access bypass app platform_ci_runner_queue).
  3. Run CI runner queue metrics once with window_hours: 72 to backfill.
  4. Pull or import the dashboard JSON.

Last job recorded goes stale if the collector is failing. Check the workflow's warnings, which include the POST status. It can also look stale overnight when no CI ran.

Regenerate:

bash
GRAFANA_INFINITY_UID=cfzakgwkklxc0a node social/grafana/build-ci-runner-queue-dashboard.mjs

GitHub Actions usage (#1082) ​

GitHub Free includes 2,000 Actions minutes a month for private repos (home-dashboard, invoice-app, …), reset each billing cycle. Public repos (lovely-hub-provision) on standard runners and the VPS runner are free and never count. Beyond the allowance, Linux minutes cost $0.006 each.

  • Data: GET /api/platform/github-actions-usage (or ?month=YYYY-MM) calls GitHub's billing usage API for the account and caches the result for 5 minutes. It splits rows into private and public repos and returns summary (privateMinutes, percentOfIncluded, projectedPercentOfIncluded, publicMinutes, billedUsd), byRepo and byDay.
  • Token: GitHub's billing usage endpoints only accept a classic personal access token. Put it in your local hub.tfvars as platform_github_billing_token, then push it to GitHub with node scripts/sync-hub-tfvars-to-github-secrets.mjs --repo marklovely/home-dashboard --profile provision (it becomes the secret PLATFORM_GITHUB_BILLING_TOKEN; the script never sends it to the public repo). Platform admin Terraform then sets it on platform Pages. An older secret named GH_BILLING_TOKEN also works. A local apply without it in hub.tfvars removes it from Pages, as with the OpenAI key. Until then the endpoint returns { "configured": false } and the panels are empty.
  • Optional Pages env: PLATFORM_GITHUB_PUBLIC_REPOS (default lovely-hub-provision; add any other public repo), PLATFORM_GITHUB_INCLUDED_MINUTES (default 2000, use 3000 on GitHub Pro), PLATFORM_GITHUB_BILLING_USER (default marklovely).
  • Dashboard: Lovely Home — GitHub Actions usage shows allowance used, private minutes, a month-end projection, the billed amount, public minutes (free), minutes per day and a per-repo table. Generate it with GRAFANA_INFINITY_UID=cfzakgwkklxc0a node social/grafana/build-github-actions-usage-dashboard.mjs.
  • Alerts: at 75% and 90% of the allowance, and when anything is billed (see Cost alerts).
  • Running low: set the repo variable HUB_REGISTRY_RUNNER=self-hosted to move customer registry runs back to the VPS (platform-provision.md).