Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[performance] support triggering subset of journeys against KIbana PR in CI #193175

Merged

Conversation

dmlemeshko
Copy link
Member

@dmlemeshko dmlemeshko commented Sep 17, 2024

Summary

It’s common request for Dev teams to run specific journeys on a PR to compare performance metrics against the main branch. These requests usually focus on a particular area, such as the Dashboard or Discover app.

To streamline the process, this PR groups relevant journeys into categories that can be triggered through an environment variable. For example, setting JOURNEYS_GROUP=dashboard will execute only the three dashboard-specific journeys, which are (usually) sufficient for evaluating the performance impact of code changes within the Dashboard app.

Current Process for Triggering Performance Builds:

  • Create a new kibana-single-user-performance build
  • Provide the following arguments:

Branch: refs/pull/<PR_number>/head
Under Options, set the environment variable: JOURNEYS_GROUP=<group_name>

Currently supported journey groups:

  • kibanaStartAndLoad
  • crud
  • dashboard
  • discover
  • maps
  • ml

Build example

Each group focuses on a specific set of journeys tied to its respective area in Kibana, allowing for more targeted performance testing. Since running group takes ~5-10 min on bare metal worker, it should not delay the regular (every 3h) runs against main branch

test locally with node scripts/run_performance.js --group <group_name>

@dmlemeshko dmlemeshko changed the title update script to support subset of perf journeys [performance] support triggering subset of journeys against KIbana PR in CI Sep 18, 2024
@dmlemeshko dmlemeshko self-assigned this Sep 18, 2024
@dmlemeshko dmlemeshko added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting v9.0.0 labels Sep 18, 2024
@dmlemeshko dmlemeshko marked this pull request as ready for review September 18, 2024 09:26
@dmlemeshko dmlemeshko requested a review from a team as a code owner September 18, 2024 09:26
@dmlemeshko dmlemeshko requested a review from a team September 18, 2024 09:26
Copy link
Member

@wayneseymour wayneseymour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one question

@@ -39,8 +39,13 @@ if [ "$BUILDKITE_PIPELINE_SLUG" == "kibana-performance-data-set-extraction" ]; t
node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --skip-warmup
else
# pipeline should use bare metal static worker
echo "--- Running performance tests"
node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION"
if [[ -z "${JOURNEYS_GROUP+x}" ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the +x bit about?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The +x is checking whether a variable is set at all, regardless of weather it has a specific value or empty string.

Now I wonder if we want to pass empty string to the script: it will handle it and return clear error message, but I also can do it directly in bash. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔
Ahh, ok so it's handled in nodejs here right: https://github.com/dmlemeshko/kibana/blob/kbn-journeys/run-subset-of-journeys/src/dev/performance/run_performance_cli.ts#L77

But to handle it in bash....
So, -z string in a bash conditional expression means True if the length of string is zero
...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah so currently, the env var can be an empty string, just like you said.
So, the conditional expression could be: if [[ "${JOURNEYS_GROUP}" = "" ]]; then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the truth block, you'd return the clear error message

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can go with the current solution.

if [[ "${JOURNEYS_GROUP}" = "" ]] could break if the variable is missing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break? It would just be an empty string right?

 JOURNEYS_GROUP="" .buildkite/scripts/steps/functional/performance_playwright.sh
 -- same as ---
 .buildkite/scripts/steps/functional/performance_playwright.sh

Am I wrong here? I'd like to know to be honest lol

Copy link
Contributor

@delanni delanni Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wayneseymour - when we run our scripts in strict mode, it will fail with an error on undefined variables. See:

➜  elastic-kibana git:(main) ✗ cat test.sh
#!/usr/bin/env bash

set -euo pipefail

echo "This is a missing variable: $TOMATO"
➜  elastic-kibana git:(main) ✗ bash test.sh
test.sh: line 5: TOMATO: unbound variable
➜  elastic-kibana git:(main) ✗ TOMATO= bash test.sh
This is a missing variable:

This is why you see in many places this notion: ${TOMATO:-} - this means $TOMATO or default to (notice the empty string :) )

Thus the expression I'm used to is:

if [[ "${VARIABLE:-}" == "" ]]; then
  # VARIABLE was empty or missing
fi

But I think Dima's +x is just as good

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @dmlemeshko

node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION"
if [[ -z "${JOURNEYS_GROUP+x}" ]]; then
echo "--- Running performance tests"
node scripts/run_performance.js --kibana-install-dir "$KIBANA_BUILD_LOCATION"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@delanni it looks like empty is ok, based on this line right?

Copy link
Contributor

@delanni delanni Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I flipped the condition in my head, it is in fact OK like it is

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaning, an empty or missing group would end up in the first branch, where we run everything

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, exactly. Thank you both for double check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this was a good nerd-scussion! ❤️ hahahaa

@dmlemeshko dmlemeshko merged commit f5975d2 into elastic:main Sep 18, 2024
25 checks passed
@dmlemeshko dmlemeshko added v8.16.0 backport:version Backport to applied version labels and removed backport:skip This commit does not require backporting labels Sep 23, 2024
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 23, 2024
… in CI (elastic#193175)

## Summary

It’s common request for Dev teams to run specific journeys on a PR to
compare performance metrics against the `main` branch. These requests
usually focus on a particular area, such as the Dashboard or Discover
app.

To streamline the process, this PR groups relevant journeys into
categories that can be triggered through an environment variable. For
example, setting `JOURNEYS_GROUP=dashboard` will execute only the three
dashboard-specific journeys, which are (usually) sufficient for
evaluating the performance impact of code changes within the Dashboard
app.

Current Process for Triggering Performance Builds:
- Create a new kibana-single-user-performance
[build](https://buildkite.com/elastic/kibana-single-user-performance#new)
- Provide the following arguments:

Branch: `refs/pull/<PR_number>/head`
Under Options, set the environment variable:
`JOURNEYS_GROUP=<group_name>`

Currently supported journey groups:
- kibanaStartAndLoad
- crud
- dashboard
- discover
- maps
- ml

[Build example

](https://buildkite.com/elastic/kibana-single-user-performance/builds/14427)
Each group focuses on a specific set of journeys tied to its respective
area in Kibana, allowing for more targeted performance testing. Since
running group takes ~5-10 min on bare metal worker, it should not delay
the regular (every 3h) runs against `main` branch

test locally with `node scripts/run_performance.js --group <group_name>`

(cherry picked from commit f5975d2)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Sep 23, 2024
…ana PR in CI (#193175) (#193680)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[performance] support triggering subset of journeys against KIbana PR
in CI (#193175)](#193175)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-18T12:53:02Z","message":"[performance]
support triggering subset of journeys against KIbana PR in CI
(#193175)\n\n## Summary\r\n\r\nIt’s common request for Dev teams to run
specific journeys on a PR to\r\ncompare performance metrics against the
`main` branch. These requests\r\nusually focus on a particular area,
such as the Dashboard or Discover\r\napp.\r\n\r\nTo streamline the
process, this PR groups relevant journeys into\r\ncategories that can be
triggered through an environment variable. For\r\nexample, setting
`JOURNEYS_GROUP=dashboard` will execute only the
three\r\ndashboard-specific journeys, which are (usually) sufficient
for\r\nevaluating the performance impact of code changes within the
Dashboard\r\napp.\r\n\r\nCurrent Process for Triggering Performance
Builds:\r\n- Create a new
kibana-single-user-performance\r\n[build](https://buildkite.com/elastic/kibana-single-user-performance#new)\r\n-
Provide the following arguments:\r\n\r\nBranch:
`refs/pull/<PR_number>/head`\r\nUnder Options, set the environment
variable:\r\n`JOURNEYS_GROUP=<group_name>`\r\n\r\nCurrently supported
journey groups:\r\n- kibanaStartAndLoad\r\n- crud\r\n- dashboard\r\n-
discover\r\n- maps\r\n- ml\r\n\r\n[Build
example\r\n\r\n](https://buildkite.com/elastic/kibana-single-user-performance/builds/14427)\r\nEach
group focuses on a specific set of journeys tied to its
respective\r\narea in Kibana, allowing for more targeted performance
testing. Since\r\nrunning group takes ~5-10 min on bare metal worker, it
should not delay\r\nthe regular (every 3h) runs against `main`
branch\r\n\r\n\r\ntest locally with `node scripts/run_performance.js
--group
<group_name>`","sha":"f5975d28fa06d6de6193d5e518084c45c65b5aed","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","v8.16.0","backport:version"],"title":"[performance]
support triggering subset of journeys against KIbana PR in
CI","number":193175,"url":"https://github.com/elastic/kibana/pull/193175","mergeCommit":{"message":"[performance]
support triggering subset of journeys against KIbana PR in CI
(#193175)\n\n## Summary\r\n\r\nIt’s common request for Dev teams to run
specific journeys on a PR to\r\ncompare performance metrics against the
`main` branch. These requests\r\nusually focus on a particular area,
such as the Dashboard or Discover\r\napp.\r\n\r\nTo streamline the
process, this PR groups relevant journeys into\r\ncategories that can be
triggered through an environment variable. For\r\nexample, setting
`JOURNEYS_GROUP=dashboard` will execute only the
three\r\ndashboard-specific journeys, which are (usually) sufficient
for\r\nevaluating the performance impact of code changes within the
Dashboard\r\napp.\r\n\r\nCurrent Process for Triggering Performance
Builds:\r\n- Create a new
kibana-single-user-performance\r\n[build](https://buildkite.com/elastic/kibana-single-user-performance#new)\r\n-
Provide the following arguments:\r\n\r\nBranch:
`refs/pull/<PR_number>/head`\r\nUnder Options, set the environment
variable:\r\n`JOURNEYS_GROUP=<group_name>`\r\n\r\nCurrently supported
journey groups:\r\n- kibanaStartAndLoad\r\n- crud\r\n- dashboard\r\n-
discover\r\n- maps\r\n- ml\r\n\r\n[Build
example\r\n\r\n](https://buildkite.com/elastic/kibana-single-user-performance/builds/14427)\r\nEach
group focuses on a specific set of journeys tied to its
respective\r\narea in Kibana, allowing for more targeted performance
testing. Since\r\nrunning group takes ~5-10 min on bare metal worker, it
should not delay\r\nthe regular (every 3h) runs against `main`
branch\r\n\r\n\r\ntest locally with `node scripts/run_performance.js
--group
<group_name>`","sha":"f5975d28fa06d6de6193d5e518084c45c65b5aed"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193175","number":193175,"mergeCommit":{"message":"[performance]
support triggering subset of journeys against KIbana PR in CI
(#193175)\n\n## Summary\r\n\r\nIt’s common request for Dev teams to run
specific journeys on a PR to\r\ncompare performance metrics against the
`main` branch. These requests\r\nusually focus on a particular area,
such as the Dashboard or Discover\r\napp.\r\n\r\nTo streamline the
process, this PR groups relevant journeys into\r\ncategories that can be
triggered through an environment variable. For\r\nexample, setting
`JOURNEYS_GROUP=dashboard` will execute only the
three\r\ndashboard-specific journeys, which are (usually) sufficient
for\r\nevaluating the performance impact of code changes within the
Dashboard\r\napp.\r\n\r\nCurrent Process for Triggering Performance
Builds:\r\n- Create a new
kibana-single-user-performance\r\n[build](https://buildkite.com/elastic/kibana-single-user-performance#new)\r\n-
Provide the following arguments:\r\n\r\nBranch:
`refs/pull/<PR_number>/head`\r\nUnder Options, set the environment
variable:\r\n`JOURNEYS_GROUP=<group_name>`\r\n\r\nCurrently supported
journey groups:\r\n- kibanaStartAndLoad\r\n- crud\r\n- dashboard\r\n-
discover\r\n- maps\r\n- ml\r\n\r\n[Build
example\r\n\r\n](https://buildkite.com/elastic/kibana-single-user-performance/builds/14427)\r\nEach
group focuses on a specific set of journeys tied to its
respective\r\narea in Kibana, allowing for more targeted performance
testing. Since\r\nrunning group takes ~5-10 min on bare metal worker, it
should not delay\r\nthe regular (every 3h) runs against `main`
branch\r\n\r\n\r\ntest locally with `node scripts/run_performance.js
--group
<group_name>`","sha":"f5975d28fa06d6de6193d5e518084c45c65b5aed"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Dzmitry Lemechko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants