From 290c4fbe9a41c1e46128286102d17334ad1bcc8f Mon Sep 17 00:00:00 2001 From: Brian Cunnie Date: Tue, 5 Aug 2025 06:56:11 -0700 Subject: [PATCH] Create Queries-per-second badge The number of queries per second we handle is simply ginormous (> 20k!), and I'd like to be able to communicate that to the user via a badge. This commit has a GitHub Actions workflow that kicks off every six hours to gather the current queries per second and create a JSON file which is pushed to a gist which is used to create a shields.io badge. Note: I'd normally test the Actions before I pushed, but it seemed overly-complicated and brittle. So I'm taking the YOLO (you only live once) approach, and pushing and hoping it works. --- .github/workflows/qps.yml | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/qps.yml diff --git a/.github/workflows/qps.yml b/.github/workflows/qps.yml new file mode 100644 index 0000000..9146c07 --- /dev/null +++ b/.github/workflows/qps.yml @@ -0,0 +1,44 @@ +name: Queries per Second shields.io badge + +on: + schedule: + - cron: "0 */6 * * *" # Runs every 6 hours + workflow_dispatch: + +jobs: + update-qps-gist: + runs-on: self-hosted + steps: + - name: Calculate QPS + id: qps + uses: docker://cunnie/fedora-golang-bosh + with: + entrypoint: /bin/bash + args: | + -c " + for NS in ns-{do-sg,gce,hetzner,ovh}.sslip.io; do + dig TXT metrics.status.sslip.io @$NS +short | + rg \"Queries:\" | + sed 's/\"Queries.*[(]//; s~/.*$~~g' + done | + awk '{ sum += $1 } END { printf \"qps=%.0f\n\", sum }' \ + > $GITHUB_OUTPUT + " + + - name: Create QPS JSON file + run: | + cat > qps.json << EOF + { + "schemaVersion": 1, + "label": "Queries / second", + "message": "${{ steps.qps.outputs.qps }}", + "color": "blue" + } + EOF + + - name: Update Gist with QPS data + uses: exuanbo/actions-deploy-gist@v1 + with: + token: ${{ secrets.GIST_TOKEN }} + gist_id: 67dc2a78c9ac6032db05027727c63ea1 + file_path: qps.json