mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.7`: - [[scalability testing] get the correct Gatling report (#153089)](https://github.com/elastic/kibana/pull/153089) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Dzmitry Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2023-03-10T12:55:34Z","message":"[scalability testing] get the correct Gatling report (#153089)\n\n## Summary\r\n\r\nAdjusting the logic to pick the correct Gatling report after run:\r\n\r\nIt turns out `startWith` was picking the wrong report since 2 api\r\njourney names match the pattern:\r\n\r\n\r\n`api.telemetry.cluster_stats.no_cache.json`\r\n`api.telemetry.cluster_stats.no_cache.1600_dataviews.json`\r\n\r\nThis PR fixes the issue, so that we report to Telemetry stats for the\r\ncorrect journey.\r\n\r\nTesting here\r\nhttps://buildkite.com/elastic/kibana-apis-capacity-testing/builds/450\r\n\r\n---------\r\n\r\nCo-authored-by: Tre' <wayne.seymour@elastic.co>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"aa1037f958f8e4a1195d12a33054c56f42eea08d","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v8.8.0","v8.6.3","v8.7.1"],"number":153089,"url":"https://github.com/elastic/kibana/pull/153089","mergeCommit":{"message":"[scalability testing] get the correct Gatling report (#153089)\n\n## Summary\r\n\r\nAdjusting the logic to pick the correct Gatling report after run:\r\n\r\nIt turns out `startWith` was picking the wrong report since 2 api\r\njourney names match the pattern:\r\n\r\n\r\n`api.telemetry.cluster_stats.no_cache.json`\r\n`api.telemetry.cluster_stats.no_cache.1600_dataviews.json`\r\n\r\nThis PR fixes the issue, so that we report to Telemetry stats for the\r\ncorrect journey.\r\n\r\nTesting here\r\nhttps://buildkite.com/elastic/kibana-apis-capacity-testing/builds/450\r\n\r\n---------\r\n\r\nCo-authored-by: Tre' <wayne.seymour@elastic.co>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"aa1037f958f8e4a1195d12a33054c56f42eea08d"}},"sourceBranch":"main","suggestedTargetBranches":["8.6","8.7"],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/153089","number":153089,"mergeCommit":{"message":"[scalability testing] get the correct Gatling report (#153089)\n\n## Summary\r\n\r\nAdjusting the logic to pick the correct Gatling report after run:\r\n\r\nIt turns out `startWith` was picking the wrong report since 2 api\r\njourney names match the pattern:\r\n\r\n\r\n`api.telemetry.cluster_stats.no_cache.json`\r\n`api.telemetry.cluster_stats.no_cache.1600_dataviews.json`\r\n\r\nThis PR fixes the issue, so that we report to Telemetry stats for the\r\ncorrect journey.\r\n\r\nTesting here\r\nhttps://buildkite.com/elastic/kibana-apis-capacity-testing/builds/450\r\n\r\n---------\r\n\r\nCo-authored-by: Tre' <wayne.seymour@elastic.co>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"aa1037f958f8e4a1195d12a33054c56f42eea08d"}},{"branch":"8.6","label":"v8.6.3","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.7","label":"v8.7.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Dzmitry Lemechko <dzmitry.lemechko@elastic.co>
This commit is contained in:
parent
ae38c63cce
commit
ba51fe0a5a
1 changed files with 11 additions and 2 deletions
|
@ -25,9 +25,18 @@ async function sendReportMetricsToTelemetry(
|
|||
) {
|
||||
const reportRootPath = path.resolve(gatlingProjectRootPath, 'target', 'gatling');
|
||||
const fileName = path.basename(scalabilityJsonPath, path.extname(scalabilityJsonPath));
|
||||
const journeyReportDir = fs.readdirSync(reportRootPath).filter((f) => f.startsWith(fileName));
|
||||
const journeyReportDir = fs
|
||||
.readdirSync(reportRootPath)
|
||||
// Gatling report folder has unique postfix, e.g. 'api.telemetry.cluster_stats.no_cache-20230309224753010'
|
||||
.filter(doesMatchWithoutSuffix);
|
||||
function doesMatchWithoutSuffix(filePath: string): boolean {
|
||||
const suffix: RegExp = /-\d+$/;
|
||||
return filePath.replace(suffix, '') === fileName;
|
||||
}
|
||||
const lastReportPath = journeyReportDir.pop();
|
||||
if (lastReportPath) {
|
||||
if (!lastReportPath) {
|
||||
throw new Error(`No report found with '${fileName}' filename`);
|
||||
} else {
|
||||
const journeyHtmlReportPath = path.resolve(reportRootPath, lastReportPath, 'index.html');
|
||||
|
||||
const journey: ScalabilityJourney = JSON.parse(fs.readFileSync(scalabilityJsonPath, 'utf8'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue