Skip to content

Trace a Performance Regression to the Commit with CI Context

Every MaxoPerf run started from CI records the repository, commit, branch and pipeline link. Use the branch filter, CI chip and git bisect to find the change.

A horizontal commit rail with eight commits labelled by short hashes, the first four green with short bars and the last four red with tall bars, split by a dashed line and a pill reading first red run d4f20b1

A performance regression rarely announces itself with a commit hash. It shows up as a line on a chart that bends upward, a customer complaint, or a nightly run that went red. Then comes the question every engineer dreads: what changed? Without a record linking each measurement to a change, the answer is a meeting.

MaxoPerf stores that record when a run is started from CI. This post shows what is recorded, where to see it, and how to turn it into a short, mechanical search for the offending commit, including a git bisect recipe whose pass/fail signal is the CLI’s exit code.

What a run remembers

When a run starts from the GitHub Action or the CLI, it carries a ciContext. The tooling fills it from the environment your CI already provides, so there is nothing to configure:

FieldMeaning
providergithub, gitlab, jenkins, circleci or bitbucket
sourceaction or cli (a deploy hook records hook, direct API calls api)
repositoryFor example acme/shop
shaThe commit
ref, branchThe git ref and branch name
prNumberThe pull request number, when there is one
environmentDeployment environment, when the event provides one
runUrlA link to the pipeline run (https only)
actorWho triggered it, where the CI exposes it

On GitHub, a pull_request run records the pull request’s head commit and its number, and a deployment_status run records the deployed commit and environment. These values are inert metadata: they are validated, stored and shown, and they do not change how the test runs.

The context is returned by GET /v1/runs/{id} and in the items of GET /v1/runs. Shared report links, the public view of a run, never expose it.

Where you see it

In the console:

  • The CI chip on the run page shows the provider, repository, PR #n or the branch, the short commit and the source (Action, CLI or Deploy hook). It links to the pipeline run, and to the commit when the provider is GitHub.
  • The Branch filter on the runs list narrows the list to runs whose recorded branch matches. The filter is bound to a ?branch= query parameter, so a filtered view is a shareable link.
  • The “Managed from GitHub” banner on a test shows the repository, path and commit the test definition was last synced from. This matters for regressions, because the test file is code too.

Over the API:

Terminal window
curl -sS "https://app.maxoperf.com/v1/runs?branch=main" \
-H "Authorization: Bearer $MAXOPERF_API_KEY" \
-H "X-Account-Id: $MAXOPERF_ACCOUNT_ID"

Each item includes its ciContext, so a script can pull the commits of recent runs without a browser.

A five-step triage

When a number moves, follow the same short path every time.

  1. Find the first bad run. Filter the runs list to the branch (usually main) and the test, open the trend and find where it stepped. Compare that run with the last good one using compare load test runs to confirm the step is real and not noise. If your gate is flaky, fix that first, because a bisect on noise finds a random commit.

  2. Read the commits from the CI chip. Note the sha of the first bad run and of the last good one.

  3. List what is between them. Use git, not a guess:

    Terminal window
    git log --oneline <good_sha>..<bad_sha>

    If the list is short, read it. A change that touches the query layer, a dependency bump or a configuration change is the first suspect.

  4. Check the test, too. Open the test’s banner or the test file history. If the YAML or the script changed in the same range, the experiment changed, and the regression may be in the measurement. git log --oneline <good_sha>..<bad_sha> -- .maxoperf perf shows only those paths.

  5. Confirm on the suspect. Re-run the check on the suspected commit and on its parent. A real regression reproduces on one and not the other.

Pull request runs help here for free. If the gate ran on the pull request, the run list already holds a run for the commit that was merged, with PR #n on the chip. A regression that merged despite an advisory gate points straight at the pull request.

Bisecting automatically

When the range is large, let git do the search. git bisect run calls a command on each candidate commit and reads its exit status: 0 means good, 1 to 127 (except 125) means bad, and 125 means “cannot test this commit, skip it”.

The CLI’s exit codes line up neatly. 0 means all runs passed. 1 means a run failed its criteria, which is a bad commit. But 2 (test-file or validation error) and 3 (API, network, blocked start or timeout) mean there is no verdict, and a bisect that treats those as “bad” blames innocent commits. Map them to a skip:

#!/bin/sh
# bisect-perf.sh: build and deploy the candidate commit to the target, then measure it.
set -u
./scripts/deploy-candidate.sh || exit 125 # cannot deploy this commit: skip it
npx @maxoperf/cli run \
--tests .maxoperf/tests/checkout-api.yml \
--config TARGET_URL="$CANDIDATE_URL"
code=$?
case "$code" in
0) exit 0 ;; # good
1) exit 1 ;; # criteria failed: bad
*) exit 125 ;; # no verdict: skip
esac

Then:

Terminal window
git bisect start <bad_sha> <good_sha>
git bisect run ./bisect-perf.sh
git bisect reset

Two caveats are important. First, run syncs the test files in the checked-out commit before running, so a commit where the YAML differs overwrites the test; either pin the .maxoperf and script files to one known version during the bisect (for example git checkout <good_sha> -- .maxoperf perf before each measurement) or accept that you are bisecting the experiment as well. Second, every step needs a target that is running that commit. That is only practical if you can deploy a candidate quickly, for example to a disposable preview. If you cannot, bisect by reading CI runs instead: the nightly or pull request history already has a measurement for many commits, so the step in the trend usually narrows the range to a few.

Keep the load small and the criteria tight during a bisect, so each step is fast and unambiguous.

Making the record better

The context is only as good as what your pipeline sends, so a few habits pay off.

  • Run the check from the pipeline that has the commit. A run started by hand from the console has no CI context. That is fine for exploration, and it cannot be placed on a commit later.
  • Send context from custom triggers. A deploy hook called with curl can carry a ciContext in its body, with provider and source required and sha, branch, repository, environment and an https runUrl optional. Add the commit from your CD system’s variables.
  • Use meaningful branches and PR titles. The branch name is a filter key. Naming conventions make the runs list readable.
  • Keep nightly and release runs on main. Scheduled runs record the default branch, which gives you a clean trend to compare other branches against.
  • Keep one test per concern. A trend line for “Checkout API” is easier to read than one for “everything”.

What this does not do

Be realistic about the limits. The context identifies the commit that was checked out, which is not always the commit that is running in the target. If a test runs against a shared environment that was last deployed three commits ago, the run is labeled with the code that started it, not the code that served it. In post-deploy flows the deployed commit is the right label, which is why the deployment_status context records the deployed commit; in a pull request flow against a shared staging environment, remember the difference when you read it.

It also records, and does not judge. A commit on a chip is a lead, not a verdict. Confirm with a repeat run before you revert anything.

Do it now

If your runs come from CI, you already have the data. Open the runs list for your most important test, filter by main, and look at the last month. If the trend has a step you cannot explain, the chip on the first run after it is your starting point. The GitHub Actions guide shows the chip, the filter and the banner with screenshots, and the CLI reference lists the exit codes used in the bisect script above.

Questions this article answers

Which CI systems record context on a run?

GitHub Actions, GitLab CI, Jenkins, CircleCI and Bitbucket Pipelines are detected by the CLI and the action. Deploy hooks and direct API calls can send the same fields themselves.

Can the run list be filtered by branch?

Yes. The console runs list has a Branch filter, and the API accepts a branch query parameter on the runs list that filters by the branch recorded in the run's CI context.