Stout enables CI Metrics per organization, on request. To use CI Metrics, ask Stout to enable it for your organization.
Set up reporting
Setup has four parts:- Create a CI key.
- Send a merge announcement for each merge.
- Send a run report for each hardware test run.
- Describe the files of each product.
Create a CI key
A CI key lets your CI send reports to Stout. It works only for the report endpoints, and it cannot reach a box. The dashboard has no page for CI keys. Use the HTTP API with the access token of an owner or admin. See HTTP API for authentication.apiKey. The key starts with stout_, followed by 64 hexadecimal characters.
The list shows the name of each key and the times when someone created it, last used it, and revoked it. The list never shows the key itself. A revoked key stops working immediately.
Send a merge announcement
Send one merge announcement for each merge to the branch that you test. Send it from a CI job that does not need the hardware. Then Stout counts each merge, also when your hardware runner is offline. If the repository holds several products, send one announcement for each product whose test suite the merge starts. A merge that changes code that two products share gets two announcements.
Stout returns HTTP 204. A second announcement with the same
repo_key, suite, and sha changes nothing.
Send a run report
At the end of each attempt of a hardware test run, send one run report. Send it when the run passes and when it fails. If the run uses several bench boxes, send one report for each box.
Each item in
tests has these fields:
The
changes object has these fields:
Each item in
commits has these fields:
For a new attempt of the same run, send the same
changes as for the first attempt.
The
changes field sends the first line of each commit message and the paths of the changed files. It sends no source code. If a failed test has no verdict, or its run has no changes, Stout cannot decide whether the failure was a real firmware bug.repo_key, run_id, run_attempt, and box_key replaces the first report.
If a request body breaks these rules, Stout returns HTTP 400. If the X-API-Key header has no key, a wrong key, or a revoked key, Stout returns HTTP 401.
Describe the files of each product
Stout finds real firmware bugs from the files that each commit changed. To do this, Stout must know which files are the firmware of a product, and which files are its test harness. Send one description for each product. When the files of a product move to other directories, send the description again.
A path pattern is relative to the root of the repository. The patterns follow the
paths filter of GitHub Actions, with fewer special characters:
*matches any characters in one directory level.**matches any characters across directory levels.- A
!at the start excludes the files that the rest of the pattern matches. Put every!pattern after all the other patterns. - A pattern that contains
?,+,[,],{,}, or\is not valid.
Read the metrics
To change the period, use the date control at the top of the page. 7d, 30d, and 90d select the last 7, 30, or 90 days. The page starts with the last 30 days. To see one product, select it in the product list. The list shows All products until you select a product. In All products, a merge that your CI announced for two products counts two times. A merge that your CI announced without a product shows as Unassigned in All products. The view of a single product does not count it.
Two merges can land in separate pushes a few seconds apart. Then the bench can test only the second push, and the first merge shows as not checked.
How Stout labels a failure
A failure is a test with the outcomefail in a run that reached the hardware. Stout gives each failure one of three labels. Stout looks at each bench box on its own, so a pass on one box does not change a failure on another box.
Stout calculates the labels each time that you open the page. A new report can change the label of an older failure.
A test can fail on several commits in a row, with no pass between the failures. Stout counts these failures as one resolved failure.
A run report with
hello_ok set to false does not count in any metric, except Infra runs.
The flake rate is the number of failed attempts, divided by all attempts, as a percentage. A test that passed on its third attempt adds two failed attempts.
Each metric uses its own date:
- Merges use
merged_at. - Resolved failures use the start time of the first run that failed.
- Flake rates and infra runs use the start time of each run.
How Stout finds real firmware bugs
Stout checks each resolved failure against three conditions. Stout counts the failure as a real firmware bug only if all three conditions are true:- The test harness blamed the device. The failed test has the verdict
device. - The commit under test changed firmware. The
changesof the first run on the failing commit include a firmware file. - The fix changed firmware, and not the test harness. Between the failure and the fix, a commit changed a firmware file. No commit in that range changed only test harness files.
Confirm or dismiss a failure
Organization owners and admins can correct the automatic label of a resolved failure. A review replaces the automatic label. Stout keeps the review when it calculates the labels again.- To count a failure from Resolved by a bench or harness change as a real firmware bug, click Confirm on its row.
- To remove a failure from Real FW bugs caught, click Dismiss on its row. Stout moves the failure to the other list, with the reason Dismissed by an admin.
- To go back to the automatic label, click Reset on the row.