main
1name: Calibrate
3# Weekly re-calibration (issue #73): read the last seven days of span telemetry from Workers Observability, judge every
4# threshold in scripts/calibrate/thresholds.json that names a metric against it, and open an issue when one has left its
5# band or a threshold has no provenance. The query needs a Cloudflare API token with Workers Observability read access
6# and the account id, as repository secrets CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID (the variables `cf`, which
7# the CD uses, reads). Without them the run reports that it was skipped and passes.
9on:
10 schedule:
11 # Mondays 14:17 UTC, off the hour.
12 - cron: "17 14 * * 1"
13 workflow_dispatch:
15permissions:
16 contents: read
18concurrency:
19 group: calibrate
20 cancel-in-progress: false
22jobs:
23 calibrate:
24 permissions:
25 contents: read
26 issues: write
27 runs-on: ubuntu-24.04
28 timeout-minutes: 30
29 env:
30 CF_SEND_TELEMETRY: "false"
31 steps:
32 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
33 with:
34 persist-credentials: false
35 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
36 with:
37 # cf needs Node ^22.23, ^24.22 or ^26.12. A bare major can resolve to an older cached release.
38 node-version: 24.22
39 cache: npm
40 # package-lock resolves ply as git+ssh. Actions has no SSH key; the repo is public.
41 - name: Fetch GitHub git dependencies over HTTPS
42 run: |
43 git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"
44 git config --global url."https://github.com/".insteadOf "git+ssh://git@github.com/"
45 git config --global url."https://github.com/".insteadOf "git@github.com:"
46 - run: npm ci
47 - name: Provenance (no credentials needed)
48 run: node --experimental-strip-types --import ./test/register-tsx.mjs --test test/calibrate-provenance.test.ts
49 - name: Re-calibrate from the last seven days
50 id: calibrate
51 env:
52 CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
53 CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
54 run: |
55 set -uo pipefail
56 if [ -z "${CLOUDFLARE_API_TOKEN}" ] || [ -z "${CLOUDFLARE_ACCOUNT_ID}" ]; then
57 echo "::notice::CLOUDFLARE_API_TOKEN or CLOUDFLARE_ACCOUNT_ID is not set; re-calibration skipped"
58 echo "outcome=skipped" >> "$GITHUB_OUTPUT"
59 exit 0
60 fi
61 node --experimental-strip-types scripts/calibrate/main.ts --since 7d --check --no-histogram \
62 --report "$RUNNER_TEMP/drift.md" --json "$RUNNER_TEMP/calibrate.json" | tee "$RUNNER_TEMP/calibrate.txt"
63 code=${PIPESTATUS[0]}
64 case "$code" in
65 0) echo "outcome=in-band" >> "$GITHUB_OUTPUT" ;;
66 1) echo "outcome=drift" >> "$GITHUB_OUTPUT" ;;
67 *) echo "outcome=error" >> "$GITHUB_OUTPUT" ;;
68 esac
69 exit "$code"
70 - name: Open or update the drift issue
71 if: failure() && steps.calibrate.outputs.outcome == 'drift'
72 env:
73 GH_TOKEN: ${{ github.token }}
74 GH_REPO: ${{ github.repository }}
75 RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
76 run: |
77 set -euo pipefail
78 title="Calibration drift: a threshold left its band"
79 printf '\n%s\n' "Run: ${RUN_URL}" >> "$RUNNER_TEMP/drift.md"
80 existing=$(gh issue list --state open --search "\"${title}\" in:title" --json number --jq '.[0].number // empty')
81 if [ -n "${existing}" ]; then
82 gh issue comment "${existing}" --body-file "$RUNNER_TEMP/drift.md"
83 else
84 gh issue create --title "${title}" --body-file "$RUNNER_TEMP/drift.md"
85 fi
86 - name: Keep the report
87 if: always() && steps.calibrate.outputs.outcome != 'skipped'
88 uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
89 with:
90 name: calibrate
91 path: |
92 ${{ runner.temp }}/calibrate.txt
93 ${{ runner.temp }}/calibrate.json
94 ${{ runner.temp }}/drift.md
95 if-no-files-found: ignore
Diagnostics4 git calls · 327 ms
CallStatusSizeTime0327 ms
discover200152 B4 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=4 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200145 B · hit4 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=4 git.response.bytes=145 git.response.cache=HIT git.response.duration_ms=4 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=145 git.pkt.payload.max=76 git.ls_refs.count=2 git.ls_refs.head=refs/heads/main
fetchblob:none · deepen 1020042 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=42585 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=262b639aa1b258fc1777c3a66ba8f811df3a3da2 git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=6 git.pkt.data=4 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=42585 git.pkt.payload.max=42490 git.sideband.band1.bytes=42489 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=61 git.pack.bytes=42489 git.pack.ofs_delta=0 git.pack.ref_delta=0 git.pack.chain.max=0 git.pack.trailer=7dbf576d97429022615f79aa46b440d9da603496 git.pack.full=61Open pack map
fetch2001.8 KiB320 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=320 git.response.bytes=1831 git.response.cache=MISS git.response.duration_ms=320 git.fetch.wants=8eff565296368b58bd4812f7d2b4f27dc6707122 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1831 git.pkt.payload.max=1810 git.sideband.band1.bytes=1809 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/ply-web.git
- Ref
- refs/heads/main
- Commit
- 262b639aa1b258fc1777c3a66ba8f811df3a3da2
- cf-ray
- a5e1bf66cb066c75
- Request
- 8ed326cf…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format