[8.8] [Synthetics] Include step metrics bounds in waterfall network requests (#156808) (#156900)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Synthetics] Include step metrics bounds in waterfall network
requests (#156808)](https://github.com/elastic/kibana/pull/156808)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT
[{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2023-05-05T17:45:25Z","message":"[Synthetics]
Include step metrics bounds in waterfall network requests
(#156808)","sha":"7524744445db662e8531654277d73acaeb71e8e1","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:uptime","release_note:skip","v8.8.0","v8.9.0"],"number":156808,"url":"https://github.com/elastic/kibana/pull/156808","mergeCommit":{"message":"[Synthetics]
Include step metrics bounds in waterfall network requests
(#156808)","sha":"7524744445db662e8531654277d73acaeb71e8e1"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/156808","number":156808,"mergeCommit":{"message":"[Synthetics]
Include step metrics bounds in waterfall network requests
(#156808)","sha":"7524744445db662e8531654277d73acaeb71e8e1"}}]}]
BACKPORT-->

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
This commit is contained in:
Kibana Machine 2023-05-05 14:53:30 -04:00 committed by GitHub
parent ebd30c181e
commit f5136d02f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -8,6 +8,7 @@
import { euiPaletteColorBlind } from '@elastic/eui';
import moment from 'moment';
import { MarkerItems } from '../../step_waterfall_chart/waterfall/context/waterfall_context';
import { NetworkEvent } from '../../../../../../../common/runtime_types';
import { WaterfallData, WaterfallMetadata } from './types';
import {
@ -128,7 +129,8 @@ export const getSeriesAndDomain = (
items: NetworkEvent[],
onlyHighlighted = false,
query?: string,
activeFilters?: string[]
activeFilters?: string[],
markerItems?: MarkerItems
) => {
const getValueForOffset = (item: NetworkEvent) => {
return item.requestSentTime;
@ -245,6 +247,12 @@ export const getSeriesAndDomain = (
filteredSeries = series.filter((item) => item.config.isHighlighted);
}
if (markerItems && markerItems.length > 0) {
// set domain to include marker items, whichever has higher time value
const highestMarkerTime = Math.max(...markerItems.map((item) => item.offset));
domain.max = Math.max(domain.max, highestMarkerTime);
}
return { series: filteredSeries, domain, metadata, totalHighlightedRequests };
};

View file

@ -55,8 +55,8 @@ export const WaterfallChartWrapper: React.FC<Props> = ({
const hasFilters = activeFilters.length > 0;
const { series, domain, metadata, totalHighlightedRequests } = useMemo(() => {
return getSeriesAndDomain(networkData, onlyHighlighted, query, activeFilters);
}, [networkData, query, activeFilters, onlyHighlighted]);
return getSeriesAndDomain(networkData, onlyHighlighted, query, activeFilters, markerItems);
}, [networkData, query, activeFilters, onlyHighlighted, markerItems]);
const sidebarItems = useMemo(() => {
return getSidebarItems(networkData, onlyHighlighted ?? false, query, activeFilters);