Skip to content

Commit 1d6e0bd

Browse files
nix(loadtest): report percentage change
This reports the percentage change between the current head branch and the main branch, which is exactly the number we'll want to make our decisions on "success or fail" on. CI failures will initially be reported for regressions of 5% or more on an individual number.
1 parent ff92846 commit 1d6e0bd

2 files changed

Lines changed: 46 additions & 2 deletions

File tree

.github/workflows/test.yaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ on:
2525
- test/**
2626
- '!**.md'
2727

28+
defaults:
29+
run:
30+
shell: bash
31+
2832
concurrency:
2933
# Terminate all previous runs of the same workflow for pull requests
3034
group: test-${{ github.head_ref || github.run_id }}
@@ -152,10 +156,34 @@ jobs:
152156
latest_tag=$(git tag --merged HEAD --sort=-creatordate "v*" | head -n1)
153157
fi
154158
postgrest-loadtest-against -k ${{ matrix.kind }} "$TARGET_BRANCH" "$latest_tag"
159+
160+
- name: Report P50
161+
# This step checks whether any red cross indicators (:x:) are present in the step summary.
162+
# The loadtest reporter writes them when any of individual steps fails the performance
163+
# regression threshold.
164+
run: |
165+
postgrest-loadtest-report -g ${{ matrix.kind }} -p 50 \
166+
| tee "$GITHUB_STEP_SUMMARY" \
167+
| grep -v ':x:'
168+
169+
- name: Report P0
170+
if: always()
171+
run: |
155172
postgrest-loadtest-report -g ${{ matrix.kind }} -p 0 >> "$GITHUB_STEP_SUMMARY"
156-
postgrest-loadtest-report -g ${{ matrix.kind }} -p 50 >> "$GITHUB_STEP_SUMMARY"
173+
174+
- name: Report P90
175+
if: always()
176+
run: |
157177
postgrest-loadtest-report -g ${{ matrix.kind }} -p 90 >> "$GITHUB_STEP_SUMMARY"
178+
179+
- name: Report P95
180+
if: always()
181+
run: |
158182
postgrest-loadtest-report -g ${{ matrix.kind }} -p 95 >> "$GITHUB_STEP_SUMMARY"
183+
184+
- name: Report CPU/MEM
185+
if: always()
186+
run: |
159187
postgrest-loadtest-report-load -g ${{ matrix.kind }} >> "$GITHUB_STEP_SUMMARY"
160188
161189
flake:

nix/tools/loadtest.nix

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,28 @@ let
274274
import sys
275275
import pandas as pd
276276
277+
278+
def evaluate_change(df):
279+
return ((df['head'] / df['main'] - 1) * 100) \
280+
.map(lambda r: "{icon} {ratio:.1f} %".format(
281+
ratio=r,
282+
# Hardcoded failure threshold for CI is 5% here.
283+
icon="" if r < 5 else ":x:"
284+
))
285+
286+
277287
pd.read_json(sys.stdin) \
278288
.rename(columns={'latency': sys.argv[1]}) \
279289
.set_index(sys.argv[1]) \
280290
.drop(['branch']) \
281291
.convert_dtypes() \
282-
.to_markdown(sys.stdout, floatfmt='.1f')
292+
.assign(change=evaluate_change) \
293+
.to_markdown(
294+
sys.stdout,
295+
floatfmt='.1f',
296+
colglobalalign='right',
297+
colalign=('left',)
298+
)
283299
'';
284300

285301

0 commit comments

Comments
 (0)