Use the Load Kit from an agent or CI

Run robotelos-load without a person: build the binary, branch on its exit code, read run.json, and keep tokens, hosts and run output out of commits and public pages.

An agent or a CI job runs the same commands as a person, but it cannot look at the screen. This page lists what it needs to run robotelos-load, decide from the exit code, read the record, and stay inside the safe limits.

Before you start

  • You know the quick start and the exit codes.
  • The job runs in a clone of the repository with the Go toolchain from go.mod.
  • A judged run also needs the target, its token in the environment, and a Grafana. Only start one if a person asked for it.

Run it

Build the tool once and run the binary. go run hides the exit code behind 1.

go build -buildvcs=true -o bin/robotelos-load ./protocol/cmd/robotelos-load
OUT=$(mktemp -d)
./bin/robotelos-load -suite smoke -runs 6 -out "$OUT" 2> "$OUT/stderr.txt"
echo $?
go build -buildvcs=true -o bin/robotelos-load.exe ./protocol/cmd/robotelos-load
$out = Join-Path ([IO.Path]::GetTempPath()) "load-$([guid]::NewGuid())"
.\bin\robotelos-load.exe -suite smoke -runs 6 -out $out 2> "$out.stderr.txt"
$LASTEXITCODE

A suite against the in-process server needs no token and no network, so it fits a job. The smoke suite with 6 runs per case takes about 10 s on a developer machine. Give every invocation its own -out directory so you know where its records are.

ExitWhat the job does
0PASS. Continue.
1FAIL. Report the reasons. Do not retry silently, and do not lower a rate to make it pass.
2Bad arguments. Fix the command. Nothing ran.
3INCOMPLETE. The run cannot say. Report the reasons. A retry is fine if the reason is an unusable generator.
4TECHNICAL_ERROR. The run could not be carried out. Report the error, not a finding about the server.
5Cancelled. Treat it as not run.

Wait for the command to end. A suite takes a while, and a judged case takes at least 105 s. Set the time limit of the job to match. A run that is interrupted ends with exit code 5.

Read the record

run.json is JSON with the schema robotelos.stressrun/1. Read these fields. A record that cannot be parsed, or whose schema is another value, is not a result.

for f in "$OUT"/*/run.json; do
  node -e 'const j=JSON.parse(require("fs").readFileSync(process.argv[1],"utf8"));
    console.log(j.case||j.suite, j.verdict, j.generator.usable);
    for (const r of j.reasons) console.log("  reason:", r)' "$f"
done
Get-ChildItem $out -Recurse -Filter run.json | ForEach-Object {
  $j = Get-Content $_.FullName -Raw | ConvertFrom-Json
  "{0} {1} usable={2}" -f ($j.case ?? $j.suite), $j.verdict, $j.generator.usable
  $j.reasons | ForEach-Object { "  reason: $_" }
}

Use verdict, reasons, generator.usable, metrics[].p99 (nanoseconds) and metrics[].failures. For a judged run also use queries[] (query, series, status, value, limit, reason, links). The full list is in the reference. In a suite, the record of a case is <out>/<run_id>/run.json and the suite summary is <out>/report.md.

For a single run without -out, stdout is one JSON document, and usable and steady.lost are the fields to check. The exit code covers them.

What never goes into a commit

  • Tokens. Pass them in environment variables (ROBOTELOS_LOAD_TOKEN, ROBOTELOS_GRAFANA_TOKEN, or the variable a target names), or in a token file outside the repository. Never use a flag or a command line, and never put one in a target file. The tool refuses unknown keys in the target file. It redacts declared tokens from the record, but only tokens it knows about.
  • Real hosts. Your copy of the target file (~/.robotelos/stress-targets.yaml) stays out of the repository. Use only 127.0.0.1 and *.example.invalid in anything you commit.
  • Run output. A run directory holds the host name of the generator, the CPU, the commit and the address of the target. stress-runs/ and stress-runs-slowed/ are ignored by git. Keep any other output directory out of a commit too.
  • Baselines are the exception. stress/baselines/<env>/<suite>/<case>.json is meant to be reviewed and committed. It holds numbers, a hash, a commit and the load, no host.

Do not publish a real report.md or run.json on a page, in an issue or in a pull request description without removing the host and target details. Examples in documentation use invented values.

Safety rules

  • No judged run on a shared target. A judged run needs the server to serve nobody else, and it writes annotations to a Grafana. A run against a target that is not marked disposable is INCOMPLETE, and dev, stg and prod can never be marked so. Run against a local or throwaway stack only. Do not start scripts/judged-stack.ps1 unless asked.
  • -Stop is destructive. pwsh scripts/judged-stack.ps1 -Stop removes the containers and data of the project robotelos-judged and its generated files.
  • No baseline from a slowed or dirty run. Never accept a baseline from stress-runs-slowed, from a directory that holds such runs, or from a run built from a dirty tree. -accept-baseline refuses a dirty tree.
  • Do not edit stress/queries.json to make a run pass. A baseline of another query hash is not compared.
  • Do not raise limits or lower the rate to turn a FAIL into a PASS. Say what failed.
  • Plain text only. A loopback address may take a token over http or ws. Another host needs https or wss. gRPC is always plaintext, so it is for loopback.

Caveats

  • Numbers from a CI runner or a developer machine are indicative. The generator, the server and other jobs share the CPU. No baseline is committed yet, and the baseline run on a dedicated Linux host has not been done.
  • The usable limit (the generator within 5 ms of its schedule) is a weak check at send intervals of 5 to 10 ms.
  • robotelos-load is a developer tool. It has no CLI, MCP or console equivalent.
  • A suite against the in-process server measures the delivery path without a database. It says nothing about PostgreSQL.

Next steps