Skip to content

Comments

[Space time] extending Scout with perfTracker fixture#212397

Merged
dmlemeshko merged 38 commits intoelastic:mainfrom
dmlemeshko:space-time/perf-insights
Mar 14, 2025
Merged

[Space time] extending Scout with perfTracker fixture#212397
dmlemeshko merged 38 commits intoelastic:mainfrom
dmlemeshko:space-time/perf-insights

Conversation

@dmlemeshko
Copy link
Contributor

@dmlemeshko dmlemeshko commented Feb 25, 2025

Summary

On-Week project "Client-side performance insights with Playwright & Lighthouse"

revisiting old PR #66224

This PR extends Scout with perfTracker fixture designed to analyze JavaScript bundle performance and page-level performance metrics in Kibana by leveraging Chrome DevTools Protocol (CDP).

It intercepts network requests, filters static bundles, and computes bundle size statistics per page load. Additionally, it collects CDP Performance Domain Metrics, allowing in-depth analysis of rendering and script execution times.

README file with more details and examples was added

Output example for /app/discover (shorten, just to share the idea):

{
  "url": "http://localhost:5620/app/discover#/",
  "bundleCount": 87,
  "totalSize": 3133420,
  "pluginCount": 9,
  "plugins": [
    {
      "name": "aiops",
      "bundlesCount": 2,
      "totalSize": 5982,
      "bundles": [
        {
          "name": "aiops.chunk.1.js",
          "transferredSize": 2013
        },
        ...
      ]
    },
    {
      "name": "discover",
      "bundlesCount": 17,
      "totalSize": 631605,
      "bundles": [
        {
          "name": "discover.chunk.1.js",
          "transferredSize": 41915
        },
        ...
      ]
    },
    {
      "name": "eventAnnotation",
      "bundlesCount": 1,
      "totalSize": 8652,
      "bundles": [
        {
          "name": "eventAnnotation.chunk.1.js",
          "transferredSize": 8652
        }
      ]
    },
    {
      "name": "expressionXY",
      "bundlesCount": 5,
      "totalSize": 203127,
      "bundles": [
        {
          "name": "expressionXY.chunk.2.js",
          "transferredSize": 5328
        },
        ...
      ]
    },
  ]
}

You can create a Scout UI test and start bundle tracker whenever you want to compute collected stats when all loading is done. Designed as test, it allows you to have individual validations for plugins, total bundle size, individual plugin size, etc.

      // Ensure all JS bundles are loaded
      await perfTracker.waitForJsLoad(cdp);

      // Collect and validate stats
      const stats = perfTracker.collectJsBundleStats(currentUrl);
      expect(
        stats.totalSize,
        `Total bundles size loaded on page should not exceed 3.0 MB`
      ).toBeLessThan(3 * 1024 * 1024);
      expect(stats.bundleCount, {
        message: `Total bundle chunks count loaded on page should not exceed 100`,
      }).toBeLessThan(100);
      expect(
        stats.plugins.map((p) => p.name),
        { message: 'Unexpected plugins were loaded on page' }
      ).toStrictEqual([
        'aiops',
        'discover',
        'eventAnnotation',
        'expressionXY',
        'kbn-ui-shared-deps-npm',
        'lens',
        'maps',
        'unifiedHistogram',
        'unifiedSearch',
      ]);
      // Validate individual plugin bundle sizes
      expect(stats.plugins.find((p) => p.name === 'discover')?.totalSize, {
        message: `Total 'discover' bundles size should not exceed 625 KB`,
      }).toBeLessThan(625 * 1024);

Full test example: https://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts

@dmlemeshko dmlemeshko force-pushed the space-time/perf-insights branch from c2cb7c8 to 00a0e7b Compare February 25, 2025 16:00
@dmlemeshko dmlemeshko changed the title Space time/perf insights [Space time] extending Scout with perfTracker fixture Feb 28, 2025
@dmlemeshko dmlemeshko self-assigned this Mar 7, 2025
@dmlemeshko dmlemeshko added wg:performance Work tracked by the performance workgroup test:scout v9.1.0 v8.19.0 v9.0.1 labels Mar 7, 2025
@dmlemeshko dmlemeshko added v9.0.0 release_note:skip Skip the PR/issue when compiling release notes and removed v9.0.1 labels Mar 7, 2025
@dmlemeshko dmlemeshko marked this pull request as ready for review March 7, 2025 14:09
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/13927036792

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts
9.0 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.0:
- Update dependency @redocly/cli to ^1.32.0 (main) (#212624)

Manual backport

To create the backport manually run:

node scripts/backport --pr 212397

Questions ?

Please refer to the Backport tool documentation

@dmlemeshko
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.0

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

Questions ?

Please refer to the Backport tool documentation

dmlemeshko added a commit to dmlemeshko/kibana that referenced this pull request Mar 18, 2025
## Summary

On-Week project "Client-side performance insights with Playwright &
Lighthouse"

revisiting old PR elastic#66224

This PR extends Scout with `perfTracker` fixture designed to analyze
JavaScript bundle performance and page-level performance metrics in
Kibana by leveraging Chrome DevTools Protocol (CDP).

It intercepts network requests, filters static bundles, and computes
bundle size statistics per page load. Additionally, it collects CDP
Performance Domain Metrics, allowing in-depth analysis of rendering and
script execution times.

[README](https://github.com/elastic/kibana/blob/c013c39b7ed92248b94716d953ad692e9328a08d/src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/performance/README.md)
file with more details and examples was added

Output example for `/app/discover` (shorten, just to share the idea):

```
{
  "url": "http://localhost:5620/app/discover#/",
  "bundleCount": 87,
  "totalSize": 3133420,
  "pluginCount": 9,
  "plugins": [
    {
      "name": "aiops",
      "bundlesCount": 2,
      "totalSize": 5982,
      "bundles": [
        {
          "name": "aiops.chunk.1.js",
          "transferredSize": 2013
        },
        ...
      ]
    },
    {
      "name": "discover",
      "bundlesCount": 17,
      "totalSize": 631605,
      "bundles": [
        {
          "name": "discover.chunk.1.js",
          "transferredSize": 41915
        },
        ...
      ]
    },
    {
      "name": "eventAnnotation",
      "bundlesCount": 1,
      "totalSize": 8652,
      "bundles": [
        {
          "name": "eventAnnotation.chunk.1.js",
          "transferredSize": 8652
        }
      ]
    },
    {
      "name": "expressionXY",
      "bundlesCount": 5,
      "totalSize": 203127,
      "bundles": [
        {
          "name": "expressionXY.chunk.2.js",
          "transferredSize": 5328
        },
        ...
      ]
    },
  ]
}
```

You can create a Scout UI test and start bundle tracker whenever you
want to compute collected stats when all loading is done. Designed as
test, it allows you to have individual validations for plugins, total
bundle size, individual plugin size, etc.

```
      // Ensure all JS bundles are loaded
      await perfTracker.waitForJsLoad(cdp);

      // Collect and validate stats
      const stats = perfTracker.collectJsBundleStats(currentUrl);
      expect(
        stats.totalSize,
        `Total bundles size loaded on page should not exceed 3.0 MB`
      ).toBeLessThan(3 * 1024 * 1024);
      expect(stats.bundleCount, {
        message: `Total bundle chunks count loaded on page should not exceed 100`,
      }).toBeLessThan(100);
      expect(
        stats.plugins.map((p) => p.name),
        { message: 'Unexpected plugins were loaded on page' }
      ).toStrictEqual([
        'aiops',
        'discover',
        'eventAnnotation',
        'expressionXY',
        'kbn-ui-shared-deps-npm',
        'lens',
        'maps',
        'unifiedHistogram',
        'unifiedSearch',
      ]);
      // Validate individual plugin bundle sizes
      expect(stats.plugins.find((p) => p.name === 'discover')?.totalSize, {
        message: `Total 'discover' bundles size should not exceed 625 KB`,
      }).toBeLessThan(625 * 1024);
```

Full test example:
https://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit b5f158b)

# Conflicts:
#	yarn.lock
dmlemeshko added a commit that referenced this pull request Mar 19, 2025
…#215016)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Space time] extending Scout with perfTracker fixture
(#212397)](#212397)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-03-14T17:35:31Z","message":"[Space
time] extending Scout with perfTracker fixture (#212397)\n\n##
Summary\n\nOn-Week project \"Client-side performance insights with
Playwright &\nLighthouse\"\n\nrevisiting old PR #66224\n\nThis PR
extends Scout with `perfTracker` fixture designed to analyze\nJavaScript
bundle performance and page-level performance metrics in\nKibana by
leveraging Chrome DevTools Protocol (CDP).\n\nIt intercepts network
requests, filters static bundles, and computes\nbundle size statistics
per page load. Additionally, it collects CDP\nPerformance Domain
Metrics, allowing in-depth analysis of rendering and\nscript execution
times.\n\n\n[README](https://github.com/elastic/kibana/blob/c013c39b7ed92248b94716d953ad692e9328a08d/src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/performance/README.md)\nfile
with more details and examples was added\n\nOutput example for
`/app/discover` (shorten, just to share the idea):\n\n```\n{\n \"url\":
\"http://localhost:5620/app/discover#/\",\n \"bundleCount\": 87,\n
\"totalSize\": 3133420,\n \"pluginCount\": 9,\n \"plugins\": [\n {\n
\"name\": \"aiops\",\n \"bundlesCount\": 2,\n \"totalSize\": 5982,\n
\"bundles\": [\n {\n \"name\": \"aiops.chunk.1.js\",\n
\"transferredSize\": 2013\n },\n ...\n ]\n },\n {\n \"name\":
\"discover\",\n \"bundlesCount\": 17,\n \"totalSize\": 631605,\n
\"bundles\": [\n {\n \"name\": \"discover.chunk.1.js\",\n
\"transferredSize\": 41915\n },\n ...\n ]\n },\n {\n \"name\":
\"eventAnnotation\",\n \"bundlesCount\": 1,\n \"totalSize\": 8652,\n
\"bundles\": [\n {\n \"name\": \"eventAnnotation.chunk.1.js\",\n
\"transferredSize\": 8652\n }\n ]\n },\n {\n \"name\":
\"expressionXY\",\n \"bundlesCount\": 5,\n \"totalSize\": 203127,\n
\"bundles\": [\n {\n \"name\": \"expressionXY.chunk.2.js\",\n
\"transferredSize\": 5328\n },\n ...\n ]\n },\n ]\n}\n```\n\nYou can
create a Scout UI test and start bundle tracker whenever you\nwant to
compute collected stats when all loading is done. Designed as\ntest, it
allows you to have individual validations for plugins, total\nbundle
size, individual plugin size, etc.\n\n```\n // Ensure all JS bundles are
loaded\n await perfTracker.waitForJsLoad(cdp);\n\n // Collect and
validate stats\n const stats =
perfTracker.collectJsBundleStats(currentUrl);\n expect(\n
stats.totalSize,\n `Total bundles size loaded on page should not exceed
3.0 MB`\n ).toBeLessThan(3 * 1024 * 1024);\n expect(stats.bundleCount,
{\n message: `Total bundle chunks count loaded on page should not exceed
100`,\n }).toBeLessThan(100);\n expect(\n stats.plugins.map((p) =>
p.name),\n { message: 'Unexpected plugins were loaded on page' }\n
).toStrictEqual([\n 'aiops',\n 'discover',\n 'eventAnnotation',\n
'expressionXY',\n 'kbn-ui-shared-deps-npm',\n 'lens',\n 'maps',\n
'unifiedHistogram',\n 'unifiedSearch',\n ]);\n // Validate individual
plugin bundle sizes\n expect(stats.plugins.find((p) => p.name ===
'discover')?.totalSize, {\n message: `Total 'discover' bundles size
should not exceed 625 KB`,\n }).toBeLessThan(625 * 1024);\n```\n\nFull
test
example:\nhttps://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b5f158bc42285c37911abca17c371f4459106fa7","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","wg:performance","backport:version","test:scout","v9.1.0","v8.19.0"],"title":"[Space
time] extending Scout with perfTracker
fixture","number":212397,"url":"https://github.com/elastic/kibana/pull/212397","mergeCommit":{"message":"[Space
time] extending Scout with perfTracker fixture (#212397)\n\n##
Summary\n\nOn-Week project \"Client-side performance insights with
Playwright &\nLighthouse\"\n\nrevisiting old PR #66224\n\nThis PR
extends Scout with `perfTracker` fixture designed to analyze\nJavaScript
bundle performance and page-level performance metrics in\nKibana by
leveraging Chrome DevTools Protocol (CDP).\n\nIt intercepts network
requests, filters static bundles, and computes\nbundle size statistics
per page load. Additionally, it collects CDP\nPerformance Domain
Metrics, allowing in-depth analysis of rendering and\nscript execution
times.\n\n\n[README](https://github.com/elastic/kibana/blob/c013c39b7ed92248b94716d953ad692e9328a08d/src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/performance/README.md)\nfile
with more details and examples was added\n\nOutput example for
`/app/discover` (shorten, just to share the idea):\n\n```\n{\n \"url\":
\"http://localhost:5620/app/discover#/\",\n \"bundleCount\": 87,\n
\"totalSize\": 3133420,\n \"pluginCount\": 9,\n \"plugins\": [\n {\n
\"name\": \"aiops\",\n \"bundlesCount\": 2,\n \"totalSize\": 5982,\n
\"bundles\": [\n {\n \"name\": \"aiops.chunk.1.js\",\n
\"transferredSize\": 2013\n },\n ...\n ]\n },\n {\n \"name\":
\"discover\",\n \"bundlesCount\": 17,\n \"totalSize\": 631605,\n
\"bundles\": [\n {\n \"name\": \"discover.chunk.1.js\",\n
\"transferredSize\": 41915\n },\n ...\n ]\n },\n {\n \"name\":
\"eventAnnotation\",\n \"bundlesCount\": 1,\n \"totalSize\": 8652,\n
\"bundles\": [\n {\n \"name\": \"eventAnnotation.chunk.1.js\",\n
\"transferredSize\": 8652\n }\n ]\n },\n {\n \"name\":
\"expressionXY\",\n \"bundlesCount\": 5,\n \"totalSize\": 203127,\n
\"bundles\": [\n {\n \"name\": \"expressionXY.chunk.2.js\",\n
\"transferredSize\": 5328\n },\n ...\n ]\n },\n ]\n}\n```\n\nYou can
create a Scout UI test and start bundle tracker whenever you\nwant to
compute collected stats when all loading is done. Designed as\ntest, it
allows you to have individual validations for plugins, total\nbundle
size, individual plugin size, etc.\n\n```\n // Ensure all JS bundles are
loaded\n await perfTracker.waitForJsLoad(cdp);\n\n // Collect and
validate stats\n const stats =
perfTracker.collectJsBundleStats(currentUrl);\n expect(\n
stats.totalSize,\n `Total bundles size loaded on page should not exceed
3.0 MB`\n ).toBeLessThan(3 * 1024 * 1024);\n expect(stats.bundleCount,
{\n message: `Total bundle chunks count loaded on page should not exceed
100`,\n }).toBeLessThan(100);\n expect(\n stats.plugins.map((p) =>
p.name),\n { message: 'Unexpected plugins were loaded on page' }\n
).toStrictEqual([\n 'aiops',\n 'discover',\n 'eventAnnotation',\n
'expressionXY',\n 'kbn-ui-shared-deps-npm',\n 'lens',\n 'maps',\n
'unifiedHistogram',\n 'unifiedSearch',\n ]);\n // Validate individual
plugin bundle sizes\n expect(stats.plugins.find((p) => p.name ===
'discover')?.totalSize, {\n message: `Total 'discover' bundles size
should not exceed 625 KB`,\n }).toBeLessThan(625 * 1024);\n```\n\nFull
test
example:\nhttps://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b5f158bc42285c37911abca17c371f4459106fa7"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/212397","number":212397,"mergeCommit":{"message":"[Space
time] extending Scout with perfTracker fixture (#212397)\n\n##
Summary\n\nOn-Week project \"Client-side performance insights with
Playwright &\nLighthouse\"\n\nrevisiting old PR #66224\n\nThis PR
extends Scout with `perfTracker` fixture designed to analyze\nJavaScript
bundle performance and page-level performance metrics in\nKibana by
leveraging Chrome DevTools Protocol (CDP).\n\nIt intercepts network
requests, filters static bundles, and computes\nbundle size statistics
per page load. Additionally, it collects CDP\nPerformance Domain
Metrics, allowing in-depth analysis of rendering and\nscript execution
times.\n\n\n[README](https://github.com/elastic/kibana/blob/c013c39b7ed92248b94716d953ad692e9328a08d/src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/performance/README.md)\nfile
with more details and examples was added\n\nOutput example for
`/app/discover` (shorten, just to share the idea):\n\n```\n{\n \"url\":
\"http://localhost:5620/app/discover#/\",\n \"bundleCount\": 87,\n
\"totalSize\": 3133420,\n \"pluginCount\": 9,\n \"plugins\": [\n {\n
\"name\": \"aiops\",\n \"bundlesCount\": 2,\n \"totalSize\": 5982,\n
\"bundles\": [\n {\n \"name\": \"aiops.chunk.1.js\",\n
\"transferredSize\": 2013\n },\n ...\n ]\n },\n {\n \"name\":
\"discover\",\n \"bundlesCount\": 17,\n \"totalSize\": 631605,\n
\"bundles\": [\n {\n \"name\": \"discover.chunk.1.js\",\n
\"transferredSize\": 41915\n },\n ...\n ]\n },\n {\n \"name\":
\"eventAnnotation\",\n \"bundlesCount\": 1,\n \"totalSize\": 8652,\n
\"bundles\": [\n {\n \"name\": \"eventAnnotation.chunk.1.js\",\n
\"transferredSize\": 8652\n }\n ]\n },\n {\n \"name\":
\"expressionXY\",\n \"bundlesCount\": 5,\n \"totalSize\": 203127,\n
\"bundles\": [\n {\n \"name\": \"expressionXY.chunk.2.js\",\n
\"transferredSize\": 5328\n },\n ...\n ]\n },\n ]\n}\n```\n\nYou can
create a Scout UI test and start bundle tracker whenever you\nwant to
compute collected stats when all loading is done. Designed as\ntest, it
allows you to have individual validations for plugins, total\nbundle
size, individual plugin size, etc.\n\n```\n // Ensure all JS bundles are
loaded\n await perfTracker.waitForJsLoad(cdp);\n\n // Collect and
validate stats\n const stats =
perfTracker.collectJsBundleStats(currentUrl);\n expect(\n
stats.totalSize,\n `Total bundles size loaded on page should not exceed
3.0 MB`\n ).toBeLessThan(3 * 1024 * 1024);\n expect(stats.bundleCount,
{\n message: `Total bundle chunks count loaded on page should not exceed
100`,\n }).toBeLessThan(100);\n expect(\n stats.plugins.map((p) =>
p.name),\n { message: 'Unexpected plugins were loaded on page' }\n
).toStrictEqual([\n 'aiops',\n 'discover',\n 'eventAnnotation',\n
'expressionXY',\n 'kbn-ui-shared-deps-npm',\n 'lens',\n 'maps',\n
'unifiedHistogram',\n 'unifiedSearch',\n ]);\n // Validate individual
plugin bundle sizes\n expect(stats.plugins.find((p) => p.name ===
'discover')?.totalSize, {\n message: `Total 'discover' bundles size
should not exceed 625 KB`,\n }).toBeLessThan(625 * 1024);\n```\n\nFull
test
example:\nhttps://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b5f158bc42285c37911abca17c371f4459106fa7"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
@dmlemeshko dmlemeshko added backport:version Backport to applied version labels and removed backport:version Backport to applied version labels labels Mar 19, 2025
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/13945254223

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts
9.0 Backport failed because of merge conflicts

You might need to backport the following PRs to 9.0:
- Update dependency @redocly/cli to ^1.32.0 (main) (#212624)

Manual backport

To create the backport manually run:

node scripts/backport --pr 212397

Questions ?

Please refer to the Backport tool documentation

dmlemeshko added a commit to dmlemeshko/kibana that referenced this pull request Mar 19, 2025
## Summary

On-Week project "Client-side performance insights with Playwright &
Lighthouse"

revisiting old PR elastic#66224

This PR extends Scout with `perfTracker` fixture designed to analyze
JavaScript bundle performance and page-level performance metrics in
Kibana by leveraging Chrome DevTools Protocol (CDP).

It intercepts network requests, filters static bundles, and computes
bundle size statistics per page load. Additionally, it collects CDP
Performance Domain Metrics, allowing in-depth analysis of rendering and
script execution times.

[README](https://github.com/elastic/kibana/blob/c013c39b7ed92248b94716d953ad692e9328a08d/src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/performance/README.md)
file with more details and examples was added

Output example for `/app/discover` (shorten, just to share the idea):

```
{
  "url": "http://localhost:5620/app/discover#/",
  "bundleCount": 87,
  "totalSize": 3133420,
  "pluginCount": 9,
  "plugins": [
    {
      "name": "aiops",
      "bundlesCount": 2,
      "totalSize": 5982,
      "bundles": [
        {
          "name": "aiops.chunk.1.js",
          "transferredSize": 2013
        },
        ...
      ]
    },
    {
      "name": "discover",
      "bundlesCount": 17,
      "totalSize": 631605,
      "bundles": [
        {
          "name": "discover.chunk.1.js",
          "transferredSize": 41915
        },
        ...
      ]
    },
    {
      "name": "eventAnnotation",
      "bundlesCount": 1,
      "totalSize": 8652,
      "bundles": [
        {
          "name": "eventAnnotation.chunk.1.js",
          "transferredSize": 8652
        }
      ]
    },
    {
      "name": "expressionXY",
      "bundlesCount": 5,
      "totalSize": 203127,
      "bundles": [
        {
          "name": "expressionXY.chunk.2.js",
          "transferredSize": 5328
        },
        ...
      ]
    },
  ]
}
```

You can create a Scout UI test and start bundle tracker whenever you
want to compute collected stats when all loading is done. Designed as
test, it allows you to have individual validations for plugins, total
bundle size, individual plugin size, etc.

```
      // Ensure all JS bundles are loaded
      await perfTracker.waitForJsLoad(cdp);

      // Collect and validate stats
      const stats = perfTracker.collectJsBundleStats(currentUrl);
      expect(
        stats.totalSize,
        `Total bundles size loaded on page should not exceed 3.0 MB`
      ).toBeLessThan(3 * 1024 * 1024);
      expect(stats.bundleCount, {
        message: `Total bundle chunks count loaded on page should not exceed 100`,
      }).toBeLessThan(100);
      expect(
        stats.plugins.map((p) => p.name),
        { message: 'Unexpected plugins were loaded on page' }
      ).toStrictEqual([
        'aiops',
        'discover',
        'eventAnnotation',
        'expressionXY',
        'kbn-ui-shared-deps-npm',
        'lens',
        'maps',
        'unifiedHistogram',
        'unifiedSearch',
      ]);
      // Validate individual plugin bundle sizes
      expect(stats.plugins.find((p) => p.name === 'discover')?.totalSize, {
        message: `Total 'discover' bundles size should not exceed 625 KB`,
      }).toBeLessThan(625 * 1024);
```

Full test example:
https://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit b5f158b)

# Conflicts:
#	renovate.json
#	yarn.lock
@dmlemeshko
Copy link
Contributor Author

💚 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

dmlemeshko added a commit that referenced this pull request Mar 19, 2025
…#215141)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Space time] extending Scout with perfTracker fixture
(#212397)](#212397)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-03-14T17:35:31Z","message":"[Space
time] extending Scout with perfTracker fixture (#212397)\n\n##
Summary\n\nOn-Week project \"Client-side performance insights with
Playwright &\nLighthouse\"\n\nrevisiting old PR #66224\n\nThis PR
extends Scout with `perfTracker` fixture designed to analyze\nJavaScript
bundle performance and page-level performance metrics in\nKibana by
leveraging Chrome DevTools Protocol (CDP).\n\nIt intercepts network
requests, filters static bundles, and computes\nbundle size statistics
per page load. Additionally, it collects CDP\nPerformance Domain
Metrics, allowing in-depth analysis of rendering and\nscript execution
times.\n\n\n[README](https://github.com/elastic/kibana/blob/c013c39b7ed92248b94716d953ad692e9328a08d/src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/performance/README.md)\nfile
with more details and examples was added\n\nOutput example for
`/app/discover` (shorten, just to share the idea):\n\n```\n{\n \"url\":
\"http://localhost:5620/app/discover#/\",\n \"bundleCount\": 87,\n
\"totalSize\": 3133420,\n \"pluginCount\": 9,\n \"plugins\": [\n {\n
\"name\": \"aiops\",\n \"bundlesCount\": 2,\n \"totalSize\": 5982,\n
\"bundles\": [\n {\n \"name\": \"aiops.chunk.1.js\",\n
\"transferredSize\": 2013\n },\n ...\n ]\n },\n {\n \"name\":
\"discover\",\n \"bundlesCount\": 17,\n \"totalSize\": 631605,\n
\"bundles\": [\n {\n \"name\": \"discover.chunk.1.js\",\n
\"transferredSize\": 41915\n },\n ...\n ]\n },\n {\n \"name\":
\"eventAnnotation\",\n \"bundlesCount\": 1,\n \"totalSize\": 8652,\n
\"bundles\": [\n {\n \"name\": \"eventAnnotation.chunk.1.js\",\n
\"transferredSize\": 8652\n }\n ]\n },\n {\n \"name\":
\"expressionXY\",\n \"bundlesCount\": 5,\n \"totalSize\": 203127,\n
\"bundles\": [\n {\n \"name\": \"expressionXY.chunk.2.js\",\n
\"transferredSize\": 5328\n },\n ...\n ]\n },\n ]\n}\n```\n\nYou can
create a Scout UI test and start bundle tracker whenever you\nwant to
compute collected stats when all loading is done. Designed as\ntest, it
allows you to have individual validations for plugins, total\nbundle
size, individual plugin size, etc.\n\n```\n // Ensure all JS bundles are
loaded\n await perfTracker.waitForJsLoad(cdp);\n\n // Collect and
validate stats\n const stats =
perfTracker.collectJsBundleStats(currentUrl);\n expect(\n
stats.totalSize,\n `Total bundles size loaded on page should not exceed
3.0 MB`\n ).toBeLessThan(3 * 1024 * 1024);\n expect(stats.bundleCount,
{\n message: `Total bundle chunks count loaded on page should not exceed
100`,\n }).toBeLessThan(100);\n expect(\n stats.plugins.map((p) =>
p.name),\n { message: 'Unexpected plugins were loaded on page' }\n
).toStrictEqual([\n 'aiops',\n 'discover',\n 'eventAnnotation',\n
'expressionXY',\n 'kbn-ui-shared-deps-npm',\n 'lens',\n 'maps',\n
'unifiedHistogram',\n 'unifiedSearch',\n ]);\n // Validate individual
plugin bundle sizes\n expect(stats.plugins.find((p) => p.name ===
'discover')?.totalSize, {\n message: `Total 'discover' bundles size
should not exceed 625 KB`,\n }).toBeLessThan(625 * 1024);\n```\n\nFull
test
example:\nhttps://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b5f158bc42285c37911abca17c371f4459106fa7","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","wg:performance","backport:version","test:scout","v9.1.0","v8.19.0"],"title":"[Space
time] extending Scout with perfTracker
fixture","number":212397,"url":"https://github.com/elastic/kibana/pull/212397","mergeCommit":{"message":"[Space
time] extending Scout with perfTracker fixture (#212397)\n\n##
Summary\n\nOn-Week project \"Client-side performance insights with
Playwright &\nLighthouse\"\n\nrevisiting old PR #66224\n\nThis PR
extends Scout with `perfTracker` fixture designed to analyze\nJavaScript
bundle performance and page-level performance metrics in\nKibana by
leveraging Chrome DevTools Protocol (CDP).\n\nIt intercepts network
requests, filters static bundles, and computes\nbundle size statistics
per page load. Additionally, it collects CDP\nPerformance Domain
Metrics, allowing in-depth analysis of rendering and\nscript execution
times.\n\n\n[README](https://github.com/elastic/kibana/blob/c013c39b7ed92248b94716d953ad692e9328a08d/src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/performance/README.md)\nfile
with more details and examples was added\n\nOutput example for
`/app/discover` (shorten, just to share the idea):\n\n```\n{\n \"url\":
\"http://localhost:5620/app/discover#/\",\n \"bundleCount\": 87,\n
\"totalSize\": 3133420,\n \"pluginCount\": 9,\n \"plugins\": [\n {\n
\"name\": \"aiops\",\n \"bundlesCount\": 2,\n \"totalSize\": 5982,\n
\"bundles\": [\n {\n \"name\": \"aiops.chunk.1.js\",\n
\"transferredSize\": 2013\n },\n ...\n ]\n },\n {\n \"name\":
\"discover\",\n \"bundlesCount\": 17,\n \"totalSize\": 631605,\n
\"bundles\": [\n {\n \"name\": \"discover.chunk.1.js\",\n
\"transferredSize\": 41915\n },\n ...\n ]\n },\n {\n \"name\":
\"eventAnnotation\",\n \"bundlesCount\": 1,\n \"totalSize\": 8652,\n
\"bundles\": [\n {\n \"name\": \"eventAnnotation.chunk.1.js\",\n
\"transferredSize\": 8652\n }\n ]\n },\n {\n \"name\":
\"expressionXY\",\n \"bundlesCount\": 5,\n \"totalSize\": 203127,\n
\"bundles\": [\n {\n \"name\": \"expressionXY.chunk.2.js\",\n
\"transferredSize\": 5328\n },\n ...\n ]\n },\n ]\n}\n```\n\nYou can
create a Scout UI test and start bundle tracker whenever you\nwant to
compute collected stats when all loading is done. Designed as\ntest, it
allows you to have individual validations for plugins, total\nbundle
size, individual plugin size, etc.\n\n```\n // Ensure all JS bundles are
loaded\n await perfTracker.waitForJsLoad(cdp);\n\n // Collect and
validate stats\n const stats =
perfTracker.collectJsBundleStats(currentUrl);\n expect(\n
stats.totalSize,\n `Total bundles size loaded on page should not exceed
3.0 MB`\n ).toBeLessThan(3 * 1024 * 1024);\n expect(stats.bundleCount,
{\n message: `Total bundle chunks count loaded on page should not exceed
100`,\n }).toBeLessThan(100);\n expect(\n stats.plugins.map((p) =>
p.name),\n { message: 'Unexpected plugins were loaded on page' }\n
).toStrictEqual([\n 'aiops',\n 'discover',\n 'eventAnnotation',\n
'expressionXY',\n 'kbn-ui-shared-deps-npm',\n 'lens',\n 'maps',\n
'unifiedHistogram',\n 'unifiedSearch',\n ]);\n // Validate individual
plugin bundle sizes\n expect(stats.plugins.find((p) => p.name ===
'discover')?.totalSize, {\n message: `Total 'discover' bundles size
should not exceed 625 KB`,\n }).toBeLessThan(625 * 1024);\n```\n\nFull
test
example:\nhttps://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b5f158bc42285c37911abca17c371f4459106fa7"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/215016","number":215016,"state":"MERGED","mergeCommit":{"sha":"270867bac6f803fcd9ccb12357710300c0770a15","message":"[9.0]
[Space time] extending Scout with perfTracker fixture (#212397)
(#215016)\n\n# Backport\n\nThis will backport the following commits from
`main` to `9.0`:\n- [[Space time] extending Scout with perfTracker
fixture\n(#212397)](https://github.com/elastic/kibana/pull/212397)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n"}},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/212397","number":212397,"mergeCommit":{"message":"[Space
time] extending Scout with perfTracker fixture (#212397)\n\n##
Summary\n\nOn-Week project \"Client-side performance insights with
Playwright &\nLighthouse\"\n\nrevisiting old PR #66224\n\nThis PR
extends Scout with `perfTracker` fixture designed to analyze\nJavaScript
bundle performance and page-level performance metrics in\nKibana by
leveraging Chrome DevTools Protocol (CDP).\n\nIt intercepts network
requests, filters static bundles, and computes\nbundle size statistics
per page load. Additionally, it collects CDP\nPerformance Domain
Metrics, allowing in-depth analysis of rendering and\nscript execution
times.\n\n\n[README](https://github.com/elastic/kibana/blob/c013c39b7ed92248b94716d953ad692e9328a08d/src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/performance/README.md)\nfile
with more details and examples was added\n\nOutput example for
`/app/discover` (shorten, just to share the idea):\n\n```\n{\n \"url\":
\"http://localhost:5620/app/discover#/\",\n \"bundleCount\": 87,\n
\"totalSize\": 3133420,\n \"pluginCount\": 9,\n \"plugins\": [\n {\n
\"name\": \"aiops\",\n \"bundlesCount\": 2,\n \"totalSize\": 5982,\n
\"bundles\": [\n {\n \"name\": \"aiops.chunk.1.js\",\n
\"transferredSize\": 2013\n },\n ...\n ]\n },\n {\n \"name\":
\"discover\",\n \"bundlesCount\": 17,\n \"totalSize\": 631605,\n
\"bundles\": [\n {\n \"name\": \"discover.chunk.1.js\",\n
\"transferredSize\": 41915\n },\n ...\n ]\n },\n {\n \"name\":
\"eventAnnotation\",\n \"bundlesCount\": 1,\n \"totalSize\": 8652,\n
\"bundles\": [\n {\n \"name\": \"eventAnnotation.chunk.1.js\",\n
\"transferredSize\": 8652\n }\n ]\n },\n {\n \"name\":
\"expressionXY\",\n \"bundlesCount\": 5,\n \"totalSize\": 203127,\n
\"bundles\": [\n {\n \"name\": \"expressionXY.chunk.2.js\",\n
\"transferredSize\": 5328\n },\n ...\n ]\n },\n ]\n}\n```\n\nYou can
create a Scout UI test and start bundle tracker whenever you\nwant to
compute collected stats when all loading is done. Designed as\ntest, it
allows you to have individual validations for plugins, total\nbundle
size, individual plugin size, etc.\n\n```\n // Ensure all JS bundles are
loaded\n await perfTracker.waitForJsLoad(cdp);\n\n // Collect and
validate stats\n const stats =
perfTracker.collectJsBundleStats(currentUrl);\n expect(\n
stats.totalSize,\n `Total bundles size loaded on page should not exceed
3.0 MB`\n ).toBeLessThan(3 * 1024 * 1024);\n expect(stats.bundleCount,
{\n message: `Total bundle chunks count loaded on page should not exceed
100`,\n }).toBeLessThan(100);\n expect(\n stats.plugins.map((p) =>
p.name),\n { message: 'Unexpected plugins were loaded on page' }\n
).toStrictEqual([\n 'aiops',\n 'discover',\n 'eventAnnotation',\n
'expressionXY',\n 'kbn-ui-shared-deps-npm',\n 'lens',\n 'maps',\n
'unifiedHistogram',\n 'unifiedSearch',\n ]);\n // Validate individual
plugin bundle sizes\n expect(stats.plugins.find((p) => p.name ===
'discover')?.totalSize, {\n message: `Total 'discover' bundles size
should not exceed 625 KB`,\n }).toBeLessThan(625 * 1024);\n```\n\nFull
test
example:\nhttps://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"b5f158bc42285c37911abca17c371f4459106fa7"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
clintandrewhall pushed a commit to clintandrewhall/kibana that referenced this pull request Mar 20, 2025
## Summary

On-Week project "Client-side performance insights with Playwright &
Lighthouse"

revisiting old PR elastic#66224

This PR extends Scout with `perfTracker` fixture designed to analyze
JavaScript bundle performance and page-level performance metrics in
Kibana by leveraging Chrome DevTools Protocol (CDP).

It intercepts network requests, filters static bundles, and computes
bundle size statistics per page load. Additionally, it collects CDP
Performance Domain Metrics, allowing in-depth analysis of rendering and
script execution times.


[README](https://github.com/elastic/kibana/blob/c013c39b7ed92248b94716d953ad692e9328a08d/src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/performance/README.md)
file with more details and examples was added

Output example for `/app/discover` (shorten, just to share the idea):

```
{
  "url": "http://localhost:5620/app/discover#/",
  "bundleCount": 87,
  "totalSize": 3133420,
  "pluginCount": 9,
  "plugins": [
    {
      "name": "aiops",
      "bundlesCount": 2,
      "totalSize": 5982,
      "bundles": [
        {
          "name": "aiops.chunk.1.js",
          "transferredSize": 2013
        },
        ...
      ]
    },
    {
      "name": "discover",
      "bundlesCount": 17,
      "totalSize": 631605,
      "bundles": [
        {
          "name": "discover.chunk.1.js",
          "transferredSize": 41915
        },
        ...
      ]
    },
    {
      "name": "eventAnnotation",
      "bundlesCount": 1,
      "totalSize": 8652,
      "bundles": [
        {
          "name": "eventAnnotation.chunk.1.js",
          "transferredSize": 8652
        }
      ]
    },
    {
      "name": "expressionXY",
      "bundlesCount": 5,
      "totalSize": 203127,
      "bundles": [
        {
          "name": "expressionXY.chunk.2.js",
          "transferredSize": 5328
        },
        ...
      ]
    },
  ]
}
```

You can create a Scout UI test and start bundle tracker whenever you
want to compute collected stats when all loading is done. Designed as
test, it allows you to have individual validations for plugins, total
bundle size, individual plugin size, etc.

```
      // Ensure all JS bundles are loaded
      await perfTracker.waitForJsLoad(cdp);

      // Collect and validate stats
      const stats = perfTracker.collectJsBundleStats(currentUrl);
      expect(
        stats.totalSize,
        `Total bundles size loaded on page should not exceed 3.0 MB`
      ).toBeLessThan(3 * 1024 * 1024);
      expect(stats.bundleCount, {
        message: `Total bundle chunks count loaded on page should not exceed 100`,
      }).toBeLessThan(100);
      expect(
        stats.plugins.map((p) => p.name),
        { message: 'Unexpected plugins were loaded on page' }
      ).toStrictEqual([
        'aiops',
        'discover',
        'eventAnnotation',
        'expressionXY',
        'kbn-ui-shared-deps-npm',
        'lens',
        'maps',
        'unifiedHistogram',
        'unifiedSearch',
      ]);
      // Validate individual plugin bundle sizes
      expect(stats.plugins.find((p) => p.name === 'discover')?.totalSize, {
        message: `Total 'discover' bundles size should not exceed 625 KB`,
      }).toBeLessThan(625 * 1024);
```

Full test example:
https://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Mar 22, 2025
## Summary

On-Week project "Client-side performance insights with Playwright &
Lighthouse"

revisiting old PR elastic#66224

This PR extends Scout with `perfTracker` fixture designed to analyze
JavaScript bundle performance and page-level performance metrics in
Kibana by leveraging Chrome DevTools Protocol (CDP).

It intercepts network requests, filters static bundles, and computes
bundle size statistics per page load. Additionally, it collects CDP
Performance Domain Metrics, allowing in-depth analysis of rendering and
script execution times.


[README](https://github.com/elastic/kibana/blob/c013c39b7ed92248b94716d953ad692e9328a08d/src/platform/packages/shared/kbn-scout/src/playwright/fixtures/test/performance/README.md)
file with more details and examples was added

Output example for `/app/discover` (shorten, just to share the idea):

```
{
  "url": "http://localhost:5620/app/discover#/",
  "bundleCount": 87,
  "totalSize": 3133420,
  "pluginCount": 9,
  "plugins": [
    {
      "name": "aiops",
      "bundlesCount": 2,
      "totalSize": 5982,
      "bundles": [
        {
          "name": "aiops.chunk.1.js",
          "transferredSize": 2013
        },
        ...
      ]
    },
    {
      "name": "discover",
      "bundlesCount": 17,
      "totalSize": 631605,
      "bundles": [
        {
          "name": "discover.chunk.1.js",
          "transferredSize": 41915
        },
        ...
      ]
    },
    {
      "name": "eventAnnotation",
      "bundlesCount": 1,
      "totalSize": 8652,
      "bundles": [
        {
          "name": "eventAnnotation.chunk.1.js",
          "transferredSize": 8652
        }
      ]
    },
    {
      "name": "expressionXY",
      "bundlesCount": 5,
      "totalSize": 203127,
      "bundles": [
        {
          "name": "expressionXY.chunk.2.js",
          "transferredSize": 5328
        },
        ...
      ]
    },
  ]
}
```

You can create a Scout UI test and start bundle tracker whenever you
want to compute collected stats when all loading is done. Designed as
test, it allows you to have individual validations for plugins, total
bundle size, individual plugin size, etc.

```
      // Ensure all JS bundles are loaded
      await perfTracker.waitForJsLoad(cdp);

      // Collect and validate stats
      const stats = perfTracker.collectJsBundleStats(currentUrl);
      expect(
        stats.totalSize,
        `Total bundles size loaded on page should not exceed 3.0 MB`
      ).toBeLessThan(3 * 1024 * 1024);
      expect(stats.bundleCount, {
        message: `Total bundle chunks count loaded on page should not exceed 100`,
      }).toBeLessThan(100);
      expect(
        stats.plugins.map((p) => p.name),
        { message: 'Unexpected plugins were loaded on page' }
      ).toStrictEqual([
        'aiops',
        'discover',
        'eventAnnotation',
        'expressionXY',
        'kbn-ui-shared-deps-npm',
        'lens',
        'maps',
        'unifiedHistogram',
        'unifiedSearch',
      ]);
      // Validate individual plugin bundle sizes
      expect(stats.plugins.find((p) => p.name === 'discover')?.totalSize, {
        message: `Total 'discover' bundles size should not exceed 625 KB`,
      }).toBeLessThan(625 * 1024);
```

Full test example:
https://github.com/elastic/kibana/blob/7b18e85541d00c3c33a9640cd38a5896b3a758ed/x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
dmlemeshko added a commit that referenced this pull request Mar 22, 2025
## Summary

With #212397 we added 2 tests for Discover app (loading `/app/discover`)
to track:
- js bundles loaded on page
- perf metrics like CPU time, Layout time and Script time fetched with
CDP Performance Domain API

While the first test for bundles _didn't report any failures_, second
test to validate Perf metrics fails periodically:


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0
```
Error: CPU time (seconds) usage during page navigation should not exceed 1.5 seconds

expect(received).toBeLessThan(expected)

Expected: < 1.5
Received:   1.591343
```


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877
```
Error: Additional time spent executing JS scripts should not exceed 0.5 second

expect(received).toBeLessThan(expected)

Expected: < 0.5
Received:   0.601434
```


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899
```
Error: Total layout computation time should not exceed 0.06 second

expect(received).toBeLessThan(expected)

Expected: < 0.06
Received:   0.061723
```


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a
```
Error: Additional time spent executing JS scripts should not exceed 0.5 second

expect(received).toBeLessThan(expected)

Expected: < 0.5
Received:   0.561259
```

It was worth an experiment, but due to flakiness we decided to keep only
bundles limits validation for now and see if it is stable in the long
run.

If Data-Discovery team has interest in collecting Perf metrics without
strict validation in PRs, we can discuss the options. Alternatively we
can wait for Scout GA and you can deep dive into your own performance
testing with Playwright/CDP.
dmlemeshko added a commit to dmlemeshko/kibana that referenced this pull request Mar 23, 2025
## Summary

With elastic#212397 we added 2 tests for Discover app (loading `/app/discover`)
to track:
- js bundles loaded on page
- perf metrics like CPU time, Layout time and Script time fetched with
CDP Performance Domain API

While the first test for bundles _didn't report any failures_, second
test to validate Perf metrics fails periodically:

https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0
```
Error: CPU time (seconds) usage during page navigation should not exceed 1.5 seconds

expect(received).toBeLessThan(expected)

Expected: < 1.5
Received:   1.591343
```

https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877
```
Error: Additional time spent executing JS scripts should not exceed 0.5 second

expect(received).toBeLessThan(expected)

Expected: < 0.5
Received:   0.601434
```

https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899
```
Error: Total layout computation time should not exceed 0.06 second

expect(received).toBeLessThan(expected)

Expected: < 0.06
Received:   0.061723
```

https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a
```
Error: Additional time spent executing JS scripts should not exceed 0.5 second

expect(received).toBeLessThan(expected)

Expected: < 0.5
Received:   0.561259
```

It was worth an experiment, but due to flakiness we decided to keep only
bundles limits validation for now and see if it is stable in the long
run.

If Data-Discovery team has interest in collecting Perf metrics without
strict validation in PRs, we can discuss the options. Alternatively we
can wait for Scout GA and you can deep dive into your own performance
testing with Playwright/CDP.

(cherry picked from commit 4dc27ba)

# Conflicts:
#	x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts
dmlemeshko added a commit to dmlemeshko/kibana that referenced this pull request Mar 23, 2025
## Summary

With elastic#212397 we added 2 tests for Discover app (loading `/app/discover`)
to track:
- js bundles loaded on page
- perf metrics like CPU time, Layout time and Script time fetched with
CDP Performance Domain API

While the first test for bundles _didn't report any failures_, second
test to validate Perf metrics fails periodically:

https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0
```
Error: CPU time (seconds) usage during page navigation should not exceed 1.5 seconds

expect(received).toBeLessThan(expected)

Expected: < 1.5
Received:   1.591343
```

https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877
```
Error: Additional time spent executing JS scripts should not exceed 0.5 second

expect(received).toBeLessThan(expected)

Expected: < 0.5
Received:   0.601434
```

https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899
```
Error: Total layout computation time should not exceed 0.06 second

expect(received).toBeLessThan(expected)

Expected: < 0.06
Received:   0.061723
```

https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a
```
Error: Additional time spent executing JS scripts should not exceed 0.5 second

expect(received).toBeLessThan(expected)

Expected: < 0.5
Received:   0.561259
```

It was worth an experiment, but due to flakiness we decided to keep only
bundles limits validation for now and see if it is stable in the long
run.

If Data-Discovery team has interest in collecting Perf metrics without
strict validation in PRs, we can discuss the options. Alternatively we
can wait for Scout GA and you can deep dive into your own performance
testing with Playwright/CDP.

(cherry picked from commit 4dc27ba)

# Conflicts:
#	x-pack/platform/plugins/private/discover_enhanced/ui_tests/tests/discover_cdp_perf.spec.ts
dmlemeshko added a commit that referenced this pull request Mar 24, 2025
…15610)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[scout] Remove perf stats validation for Discover
(#215130)](#215130)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-03-22T18:31:54Z","message":"[scout]
Remove perf stats validation for Discover (#215130)\n\n##
Summary\n\nWith #212397 we added 2 tests for Discover app (loading
`/app/discover`)\nto track:\n- js bundles loaded on page\n- perf metrics
like CPU time, Layout time and Script time fetched with\nCDP Performance
Domain API\n\nWhile the first test for bundles _didn't report any
failures_, second\ntest to validate Perf metrics fails
periodically:\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0\n```\nError:
CPU time (seconds) usage during page navigation should not exceed 1.5
seconds\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
1.5\nReceived:
1.591343\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived:
0.601434\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899\n```\nError:
Total layout computation time should not exceed 0.06
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.06\nReceived:
0.061723\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived: 0.561259\n```\n\nIt was worth an experiment, but due to
flakiness we decided to keep only\nbundles limits validation for now and
see if it is stable in the long\nrun.\n\nIf Data-Discovery team has
interest in collecting Perf metrics without\nstrict validation in PRs,
we can discuss the options. Alternatively we\ncan wait for Scout GA and
you can deep dive into your own performance\ntesting with
Playwright/CDP.","sha":"4dc27ba4aaa5bbc0a18a1964f58f2f63e2ccde16","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:version","test:scout","v9.1.0","v8.19.0"],"title":"[scout]
Remove perf stats validation for
Discover","number":215130,"url":"https://github.com/elastic/kibana/pull/215130","mergeCommit":{"message":"[scout]
Remove perf stats validation for Discover (#215130)\n\n##
Summary\n\nWith #212397 we added 2 tests for Discover app (loading
`/app/discover`)\nto track:\n- js bundles loaded on page\n- perf metrics
like CPU time, Layout time and Script time fetched with\nCDP Performance
Domain API\n\nWhile the first test for bundles _didn't report any
failures_, second\ntest to validate Perf metrics fails
periodically:\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0\n```\nError:
CPU time (seconds) usage during page navigation should not exceed 1.5
seconds\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
1.5\nReceived:
1.591343\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived:
0.601434\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899\n```\nError:
Total layout computation time should not exceed 0.06
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.06\nReceived:
0.061723\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived: 0.561259\n```\n\nIt was worth an experiment, but due to
flakiness we decided to keep only\nbundles limits validation for now and
see if it is stable in the long\nrun.\n\nIf Data-Discovery team has
interest in collecting Perf metrics without\nstrict validation in PRs,
we can discuss the options. Alternatively we\ncan wait for Scout GA and
you can deep dive into your own performance\ntesting with
Playwright/CDP.","sha":"4dc27ba4aaa5bbc0a18a1964f58f2f63e2ccde16"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/215130","number":215130,"mergeCommit":{"message":"[scout]
Remove perf stats validation for Discover (#215130)\n\n##
Summary\n\nWith #212397 we added 2 tests for Discover app (loading
`/app/discover`)\nto track:\n- js bundles loaded on page\n- perf metrics
like CPU time, Layout time and Script time fetched with\nCDP Performance
Domain API\n\nWhile the first test for bundles _didn't report any
failures_, second\ntest to validate Perf metrics fails
periodically:\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0\n```\nError:
CPU time (seconds) usage during page navigation should not exceed 1.5
seconds\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
1.5\nReceived:
1.591343\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived:
0.601434\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899\n```\nError:
Total layout computation time should not exceed 0.06
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.06\nReceived:
0.061723\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived: 0.561259\n```\n\nIt was worth an experiment, but due to
flakiness we decided to keep only\nbundles limits validation for now and
see if it is stable in the long\nrun.\n\nIf Data-Discovery team has
interest in collecting Perf metrics without\nstrict validation in PRs,
we can discuss the options. Alternatively we\ncan wait for Scout GA and
you can deep dive into your own performance\ntesting with
Playwright/CDP.","sha":"4dc27ba4aaa5bbc0a18a1964f58f2f63e2ccde16"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
JoseLuisGJ pushed a commit to JoseLuisGJ/kibana that referenced this pull request Mar 24, 2025
## Summary

With elastic#212397 we added 2 tests for Discover app (loading `/app/discover`)
to track:
- js bundles loaded on page
- perf metrics like CPU time, Layout time and Script time fetched with
CDP Performance Domain API

While the first test for bundles _didn't report any failures_, second
test to validate Perf metrics fails periodically:


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0
```
Error: CPU time (seconds) usage during page navigation should not exceed 1.5 seconds

expect(received).toBeLessThan(expected)

Expected: < 1.5
Received:   1.591343
```


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877
```
Error: Additional time spent executing JS scripts should not exceed 0.5 second

expect(received).toBeLessThan(expected)

Expected: < 0.5
Received:   0.601434
```


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899
```
Error: Total layout computation time should not exceed 0.06 second

expect(received).toBeLessThan(expected)

Expected: < 0.06
Received:   0.061723
```


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a
```
Error: Additional time spent executing JS scripts should not exceed 0.5 second

expect(received).toBeLessThan(expected)

Expected: < 0.5
Received:   0.561259
```

It was worth an experiment, but due to flakiness we decided to keep only
bundles limits validation for now and see if it is stable in the long
run.

If Data-Discovery team has interest in collecting Perf metrics without
strict validation in PRs, we can discuss the options. Alternatively we
can wait for Scout GA and you can deep dive into your own performance
testing with Playwright/CDP.
dmlemeshko added a commit that referenced this pull request Mar 26, 2025
…15611)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[scout] Remove perf stats validation for Discover
(#215130)](#215130)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Dzmitry
Lemechko","email":"dzmitry.lemechko@elastic.co"},"sourceCommit":{"committedDate":"2025-03-22T18:31:54Z","message":"[scout]
Remove perf stats validation for Discover (#215130)\n\n##
Summary\n\nWith #212397 we added 2 tests for Discover app (loading
`/app/discover`)\nto track:\n- js bundles loaded on page\n- perf metrics
like CPU time, Layout time and Script time fetched with\nCDP Performance
Domain API\n\nWhile the first test for bundles _didn't report any
failures_, second\ntest to validate Perf metrics fails
periodically:\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0\n```\nError:
CPU time (seconds) usage during page navigation should not exceed 1.5
seconds\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
1.5\nReceived:
1.591343\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived:
0.601434\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899\n```\nError:
Total layout computation time should not exceed 0.06
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.06\nReceived:
0.061723\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived: 0.561259\n```\n\nIt was worth an experiment, but due to
flakiness we decided to keep only\nbundles limits validation for now and
see if it is stable in the long\nrun.\n\nIf Data-Discovery team has
interest in collecting Perf metrics without\nstrict validation in PRs,
we can discuss the options. Alternatively we\ncan wait for Scout GA and
you can deep dive into your own performance\ntesting with
Playwright/CDP.","sha":"4dc27ba4aaa5bbc0a18a1964f58f2f63e2ccde16","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:version","test:scout","v9.1.0","v8.19.0"],"title":"[scout]
Remove perf stats validation for
Discover","number":215130,"url":"https://github.com/elastic/kibana/pull/215130","mergeCommit":{"message":"[scout]
Remove perf stats validation for Discover (#215130)\n\n##
Summary\n\nWith #212397 we added 2 tests for Discover app (loading
`/app/discover`)\nto track:\n- js bundles loaded on page\n- perf metrics
like CPU time, Layout time and Script time fetched with\nCDP Performance
Domain API\n\nWhile the first test for bundles _didn't report any
failures_, second\ntest to validate Perf metrics fails
periodically:\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0\n```\nError:
CPU time (seconds) usage during page navigation should not exceed 1.5
seconds\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
1.5\nReceived:
1.591343\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived:
0.601434\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899\n```\nError:
Total layout computation time should not exceed 0.06
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.06\nReceived:
0.061723\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived: 0.561259\n```\n\nIt was worth an experiment, but due to
flakiness we decided to keep only\nbundles limits validation for now and
see if it is stable in the long\nrun.\n\nIf Data-Discovery team has
interest in collecting Perf metrics without\nstrict validation in PRs,
we can discuss the options. Alternatively we\ncan wait for Scout GA and
you can deep dive into your own performance\ntesting with
Playwright/CDP.","sha":"4dc27ba4aaa5bbc0a18a1964f58f2f63e2ccde16"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/215610","number":215610,"state":"OPEN"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/215130","number":215130,"mergeCommit":{"message":"[scout]
Remove perf stats validation for Discover (#215130)\n\n##
Summary\n\nWith #212397 we added 2 tests for Discover app (loading
`/app/discover`)\nto track:\n- js bundles loaded on page\n- perf metrics
like CPU time, Layout time and Script time fetched with\nCDP Performance
Domain API\n\nWhile the first test for bundles _didn't report any
failures_, second\ntest to validate Perf metrics fails
periodically:\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0\n```\nError:
CPU time (seconds) usage during page navigation should not exceed 1.5
seconds\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
1.5\nReceived:
1.591343\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived:
0.601434\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899\n```\nError:
Total layout computation time should not exceed 0.06
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.06\nReceived:
0.061723\n```\n\n\nhttps://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a\n```\nError:
Additional time spent executing JS scripts should not exceed 0.5
second\n\nexpect(received).toBeLessThan(expected)\n\nExpected: <
0.5\nReceived: 0.561259\n```\n\nIt was worth an experiment, but due to
flakiness we decided to keep only\nbundles limits validation for now and
see if it is stable in the long\nrun.\n\nIf Data-Discovery team has
interest in collecting Perf metrics without\nstrict validation in PRs,
we can discuss the options. Alternatively we\ncan wait for Scout GA and
you can deep dive into your own performance\ntesting with
Playwright/CDP.","sha":"4dc27ba4aaa5bbc0a18a1964f58f2f63e2ccde16"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
cqliu1 pushed a commit to cqliu1/kibana that referenced this pull request Mar 31, 2025
## Summary

With elastic#212397 we added 2 tests for Discover app (loading `/app/discover`)
to track:
- js bundles loaded on page
- perf metrics like CPU time, Layout time and Script time fetched with
CDP Performance Domain API

While the first test for bundles _didn't report any failures_, second
test to validate Perf metrics fails periodically:


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34729#0195a4de-6cd5-4d1e-be11-5d02be6de2b0
```
Error: CPU time (seconds) usage during page navigation should not exceed 1.5 seconds

expect(received).toBeLessThan(expected)

Expected: < 1.5
Received:   1.591343
```


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34877
```
Error: Additional time spent executing JS scripts should not exceed 0.5 second

expect(received).toBeLessThan(expected)

Expected: < 0.5
Received:   0.601434
```


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34899
```
Error: Total layout computation time should not exceed 0.06 second

expect(received).toBeLessThan(expected)

Expected: < 0.06
Received:   0.061723
```


https://buildkite.com/elastic/kibana-on-merge-unsupported-ftrs/builds/34912#0195adb8-4536-42b7-ab4d-524535fdad9a
```
Error: Additional time spent executing JS scripts should not exceed 0.5 second

expect(received).toBeLessThan(expected)

Expected: < 0.5
Received:   0.561259
```

It was worth an experiment, but due to flakiness we decided to keep only
bundles limits validation for now and see if it is stable in the long
run.

If Data-Discovery team has interest in collecting Perf metrics without
strict validation in PRs, we can discuss the options. Alternatively we
can wait for Scout GA and you can deep dive into your own performance
testing with Playwright/CDP.
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 test:scout v8.19.0 v9.0.0 v9.1.0 wg:performance Work tracked by the performance workgroup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants