mirror of
https://github.com/cunnie/sslip.io.git
synced 2025-10-04 23:32:49 +08:00
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.
This commit is contained in:
44
.github/workflows/qps.yml
vendored
Normal file
44
.github/workflows/qps.yml
vendored
Normal file
@@ -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
|
Reference in New Issue
Block a user