diff --git a/hack/jenkins/test-flake-chart/flake_chart.js b/hack/jenkins/test-flake-chart/flake_chart.js index f6d16313dd..ff67b2c3a2 100644 --- a/hack/jenkins/test-flake-chart/flake_chart.js +++ b/hack/jenkins/test-flake-chart/flake_chart.js @@ -334,40 +334,87 @@ function displayEnvironmentChart(testData, environmentName) { .slice(0, topFlakes) .map(({testName}) => testName); - const data = new google.visualization.DataTable(); - data.addColumn('date', 'Date'); - for (const name of recentTopFlakes) { - data.addColumn('number', `Flake Percentage - ${name}`); - data.addColumn({ type: 'string', role: 'tooltip', 'p': { 'html': true } }); - } - data.addRows( - orderedDates.map(dateTime => [new Date(dateTime)].concat(recentTopFlakes.map(name => { - const data = aggregatedRuns.get(name).get(dateTime); - return data !== undefined ? [ - data.flakeRate, - `
+ const chartsContainer = document.getElementById('chart_div'); + { + const data = new google.visualization.DataTable(); + data.addColumn('date', 'Date'); + for (const name of recentTopFlakes) { + data.addColumn('number', `Flake Percentage - ${name}`); + data.addColumn({ type: 'string', role: 'tooltip', 'p': { 'html': true } }); + } + data.addRows( + orderedDates.map(dateTime => [new Date(dateTime)].concat(recentTopFlakes.map(name => { + const data = aggregatedRuns.get(name).get(dateTime); + return data !== undefined ? [ + data.flakeRate, + `
${name}
${data.date.toString()}
Flake Percentage: ${data.flakeRate.toFixed(2)}%
Hashes:
${data.commitHashes.map(({ hash, failures, runs }) => ` - ${hash} (Failures: ${failures}/${runs})`).join("
")}
` - ] : [null, null]; - })).flat()) - ); - const options = { - title: `Flake rate by day of top ${topFlakes} of recent test flakiness (past ${dateRange} days) on ${environmentName}`, - width: window.innerWidth, - height: window.innerHeight, - pointSize: 10, - pointShape: "circle", - vAxes: { - 0: { title: "Flake rate", minValue: 0, maxValue: 100 }, - }, - tooltip: { trigger: "selection", isHtml: true } - }; - const chart = new google.visualization.LineChart(document.getElementById('chart_div')); - chart.draw(data, options); + ] : [null, null]; + })).flat()) + ); + const options = { + title: `Flake rate by day of top ${topFlakes} of recent test flakiness (past ${dateRange} days) on ${environmentName}`, + width: window.innerWidth, + height: window.innerHeight, + pointSize: 10, + pointShape: "circle", + vAxes: { + 0: { title: "Flake rate", minValue: 0, maxValue: 100 }, + }, + tooltip: { trigger: "selection", isHtml: true } + }; + const flakeRateContainer = document.createElement("div"); + flakeRateContainer.style.width = "100vw"; + flakeRateContainer.style.height = "100vh"; + chartsContainer.appendChild(flakeRateContainer); + const chart = new google.visualization.LineChart(flakeRateContainer); + chart.draw(data, options); + } + { + const data = new google.visualization.DataTable(); + data.addColumn('date', 'Date'); + for (const name of recentTopFlakes) { + data.addColumn('number', `Duration - ${name}`); + data.addColumn({ type: 'string', role: 'tooltip', 'p': { 'html': true } }); + } + data.addRows( + orderedDates.map(dateTime => [new Date(dateTime)].concat(recentTopFlakes.map(name => { + const data = aggregatedRuns.get(name).get(dateTime); + return data !== undefined ? [ + data.duration, + `
+ ${name}
+ ${data.date.toString()}
+ Average Duration: ${data.duration.toFixed(2)}s
+ Hashes:
+ ${data.commitHashes.map(({ hash, duration, runs }) => ` - ${hash} (Average Duration: ${duration.toFixed(2)}s [${runs} runs])`).join("
")} +
` + ] : [null, null]; + })).flat()) + ); + const options = { + title: `Average duration by day of top ${topFlakes} of recent test flakiness (past ${dateRange} days) on ${environmentName}`, + width: window.innerWidth, + height: window.innerHeight, + pointSize: 10, + pointShape: "circle", + vAxes: { + 0: { title: "Average Duration (s)" }, + }, + tooltip: { trigger: "selection", isHtml: true } + }; + const durationContainer = document.createElement("div"); + durationContainer.style.width = "100vw"; + durationContainer.style.height = "100vh"; + chartsContainer.appendChild(durationContainer); + const chart = new google.visualization.LineChart(durationContainer); + chart.draw(data, options); + } document.body.appendChild(createRecentFlakePercentageTable(recentFlakePercentage, previousFlakePercentageMap, environmentName)); }