A JavaScript function expression called once for every build, to turn the objects extracted from that build's runs into the statistics to report (averages, percentiles, …). It receives one object with: build (the build number or tag), runs (array of the objects returned by "Extract function" for the build's succeeded or timed-out runs whose extraction worked) and utils (sum, mean, median and round helpers). It may be async and must return a plain object, e.g. { meanDurationSecs: 12.3 }. The object, plus build, becomes one item of the default dataset, and every field that is a number in all builds is plotted in its own chart. Each build is aggregated on its own, so the function cannot compare builds with each other (e.g. against a baseline build).
Default:({ runs, utils }) => {
const average = (field, decimals) => utils.round(utils.mean(runs.map((run) => run[field])), decimals);
return {
durationSecs: average('durationSecs', 2),
itemCount: average('itemCount', 2),
totalCost: average('totalCost', 6),
itemsPerSecond: average('itemsPerSecond', 4),
costPerItem: average('costPerItem', 8),
};
}