Skip to content

Commit 9e0bc9f

Browse files
[8.15] [Synthetics] waterfall chart - handle cached resources (#193089) (#193376)
# Backport This will backport the following commits from `main` to `8.15`: - [[Synthetics] waterfall chart - handle cached resources (#193089)](#193089) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Dominique Clarke","email":"dominique.clarke@elastic.co"},"sourceCommit":{"committedDate":"2024-09-19T01:32:45Z","message":"[Synthetics] waterfall chart - handle cached resources (#193089)\n\n## Summary\r\n\r\nResolves https://github.com/elastic/kibana/issues/184794\r\n\r\nEnsures that the cached resources display accurate timing information on\r\nthe waterfall chart tooltips.\r\n\r\nThe information displayed should match the information displayed in the\r\nflyout when the request url is clicked.\r\n\r\nTooltip\r\n<img width=\"555\" alt=\"Screenshot 2024-09-16 at 8 49 55 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/516653bc-dcec-4681-965b-08711417ab67\">\r\n\r\nFlyout\r\n<img width=\"424\" alt=\"Screenshot 2024-09-16 at 2 07 56 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/5fb0bf1c-c65d-4ce3-8a6a-5e95700209dd\">\r\n\r\n### Release note\r\n\r\nSynthetics - resolves an issue for multi step browser journeys where\r\ntimings for cached resources within the same step were inaccurate within\r\nthe waterfall chart.\r\n\r\n### Testing\r\n\r\n1. Create a browser monitor with duplicate requests. For example: \r\n```\r\nstep(\"multi resource step\", async () => {\r\n await page.goto('https://github.com');\r\n await page.goto('https://github.com');\r\n await page.goto('https://github.com');\r\n})\r\n```\r\n2. Navigate to the monitor details page\r\n3. Find the last test run panel, click the view test details button,\r\nthen click the view performance breakdown button\r\n\r\n![image](https://github.com/user-attachments/assets/b66addcb-21f6-4eac-8c60-dc3387b33853)\r\n\r\n![image](https://github.com/user-attachments/assets/67f04b9f-4ff6-4ce6-85d1-2a89869e4a2c)\r\n4. Scroll down to the waterfall chart. If you use github, requests after\r\nabout 115 should be cached. Note: some request may have been aborted and\r\ntheir waterfall tooltip won't show. Find a request that was not aborted,\r\nhover to see the tooltip, then click the request to view the flyout and\r\nconfirm the information.","sha":"6f4be61d13431f2327cabc50c71b999451821948","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","v9.0.0","ci:project-deploy-observability","Team:obs-ux-management","v8.16.0","v8.15.2"],"title":"[Synthetics] waterfall chart - handle cached resources","number":193089,"url":"https://github.com/elastic/kibana/pull/193089","mergeCommit":{"message":"[Synthetics] waterfall chart - handle cached resources (#193089)\n\n## Summary\r\n\r\nResolves https://github.com/elastic/kibana/issues/184794\r\n\r\nEnsures that the cached resources display accurate timing information on\r\nthe waterfall chart tooltips.\r\n\r\nThe information displayed should match the information displayed in the\r\nflyout when the request url is clicked.\r\n\r\nTooltip\r\n<img width=\"555\" alt=\"Screenshot 2024-09-16 at 8 49 55 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/516653bc-dcec-4681-965b-08711417ab67\">\r\n\r\nFlyout\r\n<img width=\"424\" alt=\"Screenshot 2024-09-16 at 2 07 56 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/5fb0bf1c-c65d-4ce3-8a6a-5e95700209dd\">\r\n\r\n### Release note\r\n\r\nSynthetics - resolves an issue for multi step browser journeys where\r\ntimings for cached resources within the same step were inaccurate within\r\nthe waterfall chart.\r\n\r\n### Testing\r\n\r\n1. Create a browser monitor with duplicate requests. For example: \r\n```\r\nstep(\"multi resource step\", async () => {\r\n await page.goto('https://github.com');\r\n await page.goto('https://github.com');\r\n await page.goto('https://github.com');\r\n})\r\n```\r\n2. Navigate to the monitor details page\r\n3. Find the last test run panel, click the view test details button,\r\nthen click the view performance breakdown button\r\n\r\n![image](https://github.com/user-attachments/assets/b66addcb-21f6-4eac-8c60-dc3387b33853)\r\n\r\n![image](https://github.com/user-attachments/assets/67f04b9f-4ff6-4ce6-85d1-2a89869e4a2c)\r\n4. Scroll down to the waterfall chart. If you use github, requests after\r\nabout 115 should be cached. Note: some request may have been aborted and\r\ntheir waterfall tooltip won't show. Find a request that was not aborted,\r\nhover to see the tooltip, then click the request to view the flyout and\r\nconfirm the information.","sha":"6f4be61d13431f2327cabc50c71b999451821948"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193089","number":193089,"mergeCommit":{"message":"[Synthetics] waterfall chart - handle cached resources (#193089)\n\n## Summary\r\n\r\nResolves https://github.com/elastic/kibana/issues/184794\r\n\r\nEnsures that the cached resources display accurate timing information on\r\nthe waterfall chart tooltips.\r\n\r\nThe information displayed should match the information displayed in the\r\nflyout when the request url is clicked.\r\n\r\nTooltip\r\n<img width=\"555\" alt=\"Screenshot 2024-09-16 at 8 49 55 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/516653bc-dcec-4681-965b-08711417ab67\">\r\n\r\nFlyout\r\n<img width=\"424\" alt=\"Screenshot 2024-09-16 at 2 07 56 PM\"\r\nsrc=\"https://github.com/user-attachments/assets/5fb0bf1c-c65d-4ce3-8a6a-5e95700209dd\">\r\n\r\n### Release note\r\n\r\nSynthetics - resolves an issue for multi step browser journeys where\r\ntimings for cached resources within the same step were inaccurate within\r\nthe waterfall chart.\r\n\r\n### Testing\r\n\r\n1. Create a browser monitor with duplicate requests. For example: \r\n```\r\nstep(\"multi resource step\", async () => {\r\n await page.goto('https://github.com');\r\n await page.goto('https://github.com');\r\n await page.goto('https://github.com');\r\n})\r\n```\r\n2. Navigate to the monitor details page\r\n3. Find the last test run panel, click the view test details button,\r\nthen click the view performance breakdown button\r\n\r\n![image](https://github.com/user-attachments/assets/b66addcb-21f6-4eac-8c60-dc3387b33853)\r\n\r\n![image](https://github.com/user-attachments/assets/67f04b9f-4ff6-4ce6-85d1-2a89869e4a2c)\r\n4. Scroll down to the waterfall chart. If you use github, requests after\r\nabout 115 should be cached. Note: some request may have been aborted and\r\ntheir waterfall tooltip won't show. Find a request that was not aborted,\r\nhover to see the tooltip, then click the request to view the flyout and\r\nconfirm the information.","sha":"6f4be61d13431f2327cabc50c71b999451821948"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
1 parent 934419c commit 9e0bc9f

File tree

16 files changed

+164
-222
lines changed

16 files changed

+164
-222
lines changed

x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/step_details_page/common/network_data/data_formatting.test.ts

Lines changed: 16 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ import {
1212
getSeriesAndDomain,
1313
getSidebarItems,
1414
} from './data_formatting';
15-
import { MimeType, FriendlyFlyoutLabels, FriendlyTimingLabels, Timings, Metadata } from './types';
16-
import { WaterfallDataEntry } from './types';
15+
import {
16+
MimeType,
17+
FriendlyFlyoutLabels,
18+
FriendlyTimingLabels,
19+
Timings,
20+
Metadata,
21+
WaterfallTooltipItem,
22+
} from './types';
1723
import type { DateFormatter } from '../../../../../../hooks/use_date_format';
1824
import { mockMoment } from '../../../../utils/formatting/test_helpers';
1925
import { NetworkEvent } from '../../../../../../../common/runtime_types';
@@ -247,11 +253,6 @@ describe('getSeriesAndDomain', () => {
247253
"colour": "#b0c9e0",
248254
"id": 0,
249255
"isHighlighted": true,
250-
"showTooltip": true,
251-
"tooltipProps": Object {
252-
"colour": "#b0c9e0",
253-
"value": "Queued / Blocked: 0.9ms",
254-
},
255256
},
256257
"x": 0,
257258
"y": 0.8540000017092098,
@@ -262,11 +263,6 @@ describe('getSeriesAndDomain', () => {
262263
"colour": "#aad9cc",
263264
"id": 0,
264265
"isHighlighted": true,
265-
"showTooltip": true,
266-
"tooltipProps": Object {
267-
"colour": "#aad9cc",
268-
"value": "DNS: 4ms",
269-
},
270266
},
271267
"x": 0,
272268
"y": 4.413999999087537,
@@ -277,11 +273,6 @@ describe('getSeriesAndDomain', () => {
277273
"colour": "#c8b8dc",
278274
"id": 0,
279275
"isHighlighted": true,
280-
"showTooltip": true,
281-
"tooltipProps": Object {
282-
"colour": "#c8b8dc",
283-
"value": "Connecting: 26ms",
284-
},
285276
},
286277
"x": 0,
287278
"y": 30.135000000882428,
@@ -292,11 +283,6 @@ describe('getSeriesAndDomain', () => {
292283
"colour": "#e5c7d7",
293284
"id": 0,
294285
"isHighlighted": true,
295-
"showTooltip": true,
296-
"tooltipProps": Object {
297-
"colour": "#e5c7d7",
298-
"value": "TLS: 55ms",
299-
},
300286
},
301287
"x": 0,
302288
"y": 85.52200000121957,
@@ -307,11 +293,6 @@ describe('getSeriesAndDomain', () => {
307293
"colour": "#f3b3a6",
308294
"id": 0,
309295
"isHighlighted": true,
310-
"showTooltip": true,
311-
"tooltipProps": Object {
312-
"colour": "#f3b3a6",
313-
"value": "Sending request: 0.4ms",
314-
},
315296
},
316297
"x": 0,
317298
"y": 85.88200000303914,
@@ -322,11 +303,6 @@ describe('getSeriesAndDomain', () => {
322303
"colour": "#e7664c",
323304
"id": 0,
324305
"isHighlighted": true,
325-
"showTooltip": true,
326-
"tooltipProps": Object {
327-
"colour": "#e7664c",
328-
"value": "Waiting (TTFB): 35ms",
329-
},
330306
},
331307
"x": 0,
332308
"y": 120.4600000019127,
@@ -337,11 +313,6 @@ describe('getSeriesAndDomain', () => {
337313
"colour": "#9170b8",
338314
"id": 0,
339315
"isHighlighted": true,
340-
"showTooltip": true,
341-
"tooltipProps": Object {
342-
"colour": "#9170b8",
343-
"value": "Content downloading (CSS): 0.6ms",
344-
},
345316
},
346317
"x": 0,
347318
"y": 121.01200000324752,
@@ -352,11 +323,6 @@ describe('getSeriesAndDomain', () => {
352323
"colour": "#b0c9e0",
353324
"id": 1,
354325
"isHighlighted": true,
355-
"showTooltip": true,
356-
"tooltipProps": Object {
357-
"colour": "#b0c9e0",
358-
"value": "Queued / Blocked: 85ms",
359-
},
360326
},
361327
"x": 1,
362328
"y": 84.90799999795854,
@@ -367,11 +333,6 @@ describe('getSeriesAndDomain', () => {
367333
"colour": "#f3b3a6",
368334
"id": 1,
369335
"isHighlighted": true,
370-
"showTooltip": true,
371-
"tooltipProps": Object {
372-
"colour": "#f3b3a6",
373-
"value": "Sending request: 0.2ms",
374-
},
375336
},
376337
"x": 1,
377338
"y": 85.14699999883305,
@@ -382,11 +343,6 @@ describe('getSeriesAndDomain', () => {
382343
"colour": "#e7664c",
383344
"id": 1,
384345
"isHighlighted": true,
385-
"showTooltip": true,
386-
"tooltipProps": Object {
387-
"colour": "#e7664c",
388-
"value": "Waiting (TTFB): 53ms",
389-
},
390346
},
391347
"x": 1,
392348
"y": 137.70799999925657,
@@ -397,11 +353,6 @@ describe('getSeriesAndDomain', () => {
397353
"colour": "#da8b45",
398354
"id": 1,
399355
"isHighlighted": true,
400-
"showTooltip": true,
401-
"tooltipProps": Object {
402-
"colour": "#da8b45",
403-
"value": "Content downloading (JS): 3ms",
404-
},
405356
},
406357
"x": 1,
407358
"y": 140.7760000010603,
@@ -420,11 +371,6 @@ describe('getSeriesAndDomain', () => {
420371
"colour": "#b0c9e0",
421372
"id": 0,
422373
"isHighlighted": true,
423-
"showTooltip": true,
424-
"tooltipProps": Object {
425-
"colour": "#b0c9e0",
426-
"value": "Queued / Blocked: 0.9ms",
427-
},
428374
},
429375
"x": 0,
430376
"y": 0.8540000017092098,
@@ -435,11 +381,6 @@ describe('getSeriesAndDomain', () => {
435381
"colour": "#aad9cc",
436382
"id": 0,
437383
"isHighlighted": true,
438-
"showTooltip": true,
439-
"tooltipProps": Object {
440-
"colour": "#aad9cc",
441-
"value": "DNS: 4ms",
442-
},
443384
},
444385
"x": 0,
445386
"y": 4.413999999087537,
@@ -450,11 +391,6 @@ describe('getSeriesAndDomain', () => {
450391
"colour": "#c8b8dc",
451392
"id": 0,
452393
"isHighlighted": true,
453-
"showTooltip": true,
454-
"tooltipProps": Object {
455-
"colour": "#c8b8dc",
456-
"value": "Connecting: 26ms",
457-
},
458394
},
459395
"x": 0,
460396
"y": 30.135000000882428,
@@ -465,11 +401,6 @@ describe('getSeriesAndDomain', () => {
465401
"colour": "#e5c7d7",
466402
"id": 0,
467403
"isHighlighted": true,
468-
"showTooltip": true,
469-
"tooltipProps": Object {
470-
"colour": "#e5c7d7",
471-
"value": "TLS: 55ms",
472-
},
473404
},
474405
"x": 0,
475406
"y": 85.52200000121957,
@@ -480,11 +411,6 @@ describe('getSeriesAndDomain', () => {
480411
"colour": "#f3b3a6",
481412
"id": 0,
482413
"isHighlighted": true,
483-
"showTooltip": true,
484-
"tooltipProps": Object {
485-
"colour": "#f3b3a6",
486-
"value": "Sending request: 0.4ms",
487-
},
488414
},
489415
"x": 0,
490416
"y": 85.88200000303914,
@@ -495,11 +421,6 @@ describe('getSeriesAndDomain', () => {
495421
"colour": "#e7664c",
496422
"id": 0,
497423
"isHighlighted": true,
498-
"showTooltip": true,
499-
"tooltipProps": Object {
500-
"colour": "#e7664c",
501-
"value": "Waiting (TTFB): 35ms",
502-
},
503424
},
504425
"x": 0,
505426
"y": 120.4600000019127,
@@ -510,11 +431,6 @@ describe('getSeriesAndDomain', () => {
510431
"colour": "#9170b8",
511432
"id": 0,
512433
"isHighlighted": true,
513-
"showTooltip": true,
514-
"tooltipProps": Object {
515-
"colour": "#9170b8",
516-
"value": "Content downloading (CSS): 0.6ms",
517-
},
518434
},
519435
"x": 0,
520436
"y": 121.01200000324752,
@@ -524,11 +440,6 @@ describe('getSeriesAndDomain', () => {
524440
"config": Object {
525441
"colour": "#da8b45",
526442
"isHighlighted": true,
527-
"showTooltip": true,
528-
"tooltipProps": Object {
529-
"colour": "#da8b45",
530-
"value": "Content downloading (JS): 3ms",
531-
},
532443
},
533444
"x": 1,
534445
"y": 3.714999998046551,
@@ -546,8 +457,6 @@ describe('getSeriesAndDomain', () => {
546457
"config": Object {
547458
"colour": "",
548459
"isHighlighted": true,
549-
"showTooltip": false,
550-
"tooltipProps": undefined,
551460
},
552461
"x": 0,
553462
"y": 0,
@@ -614,8 +523,10 @@ describe('getSeriesAndDomain', () => {
614523
"value": undefined,
615524
},
616525
],
526+
"networkItemTooltipProps": Array [],
617527
"requestHeaders": undefined,
618528
"responseHeaders": undefined,
529+
"showTooltip": false,
619530
"url": "file:///Users/dominiqueclarke/dev/synthetics/examples/todos/app/app.js",
620531
"x": 0,
621532
},
@@ -625,8 +536,6 @@ describe('getSeriesAndDomain', () => {
625536
"config": Object {
626537
"colour": "",
627538
"isHighlighted": true,
628-
"showTooltip": false,
629-
"tooltipProps": undefined,
630539
},
631540
"x": 0,
632541
"y": 0,
@@ -660,23 +569,21 @@ describe('getSeriesAndDomain', () => {
660569
});
661570

662571
it('handles formatting when mime type is not mapped to a specific mime type bucket', () => {
663-
const { series } = getSeriesAndDomain(
572+
const { metadata } = getSeriesAndDomain(
664573
networkItemsWithUnknownMimeType,
665574
false,
666575
mockDateFormatter
667576
);
668577
/* verify that raw mime type appears in the tooltip config and that
669578
* the colour is mapped to mime type other */
670-
const contentDownloadingConfigItem = series.find((item: WaterfallDataEntry) => {
671-
const { tooltipProps } = item.config;
672-
if (tooltipProps && typeof tooltipProps.value === 'string') {
579+
const contentDownloadingConfigItem = metadata[0].networkItemTooltipProps.find(
580+
(item: WaterfallTooltipItem) => {
673581
return (
674-
tooltipProps.value.includes('application/x-unknown') &&
675-
tooltipProps.colour === colourPalette[MimeType.Other]
582+
item.value.includes('application/x-unknown') &&
583+
item.colour === colourPalette[MimeType.Other]
676584
);
677585
}
678-
return false;
679-
});
586+
);
680587
expect(contentDownloadingConfigItem).toBeDefined();
681588
});
682589

0 commit comments

Comments
 (0)