From f467bd2947b0a3ef98ada3a8e9e57ac4ef7c15f6 Mon Sep 17 00:00:00 2001 From: Robert Lemke Date: Fri, 3 Jul 2026 09:12:30 +0200 Subject: [PATCH] Add Grafana Cloud heartbeat metric push to scheduled build Pushes a flownative_ci_last_success_timestamp_seconds gauge to Grafana Cloud after each successful scheduled build, as the dead-man-switch replacement for the OpsGenie heartbeat (runs in parallel to the existing OpsGenie mail during the OnCall migration). A Grafana alert routes to Beach Minor when the metric goes stale for more than 3 days. --- .github/workflows/docker.build.bookworm.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/docker.build.bookworm.yaml b/.github/workflows/docker.build.bookworm.yaml index c5e9582..5807ff3 100644 --- a/.github/workflows/docker.build.bookworm.yaml +++ b/.github/workflows/docker.build.bookworm.yaml @@ -83,3 +83,22 @@ jobs: to: docker-build-base@flownative.heartbeat.eu.opsgenie.net from: Github Actions body: Build job of ${{github.repository}} completed successfully! + + - name: Push heartbeat metric to Grafana Cloud + if: success() + env: + RW_URL: ${{ secrets.GRAFANA_METRICS_RW_URL }} + INSTANCE_ID: ${{ secrets.GRAFANA_METRICS_INSTANCE_ID }} + TOKEN: ${{ secrets.GRAFANA_METRICS_PUSH_TOKEN }} + run: | + set -euo pipefail + # Derive the Influx line-protocol push endpoint from the Prometheus + # remote-write endpoint (same account, different host/path). + INFLUX_URL="$(printf '%s' "$RW_URL" | sed -e 's#prometheus-#influx-#' -e 's#/api/prom/push#/api/v1/push/influx/write#')" + NOW="$(date +%s)" + # measurement + field 'seconds' -> metric flownative_ci_last_success_timestamp_seconds + curl -sf --retry 3 --retry-all-errors \ + -u "${INSTANCE_ID}:${TOKEN}" \ + -H 'Content-Type: text/plain' \ + "${INFLUX_URL}" \ + --data-binary "flownative_ci_last_success_timestamp,job=docker-build,image=base seconds=${NOW}"