Skip to content

Commit

Permalink
[Synthetics] Waterfall view (elastic#84821)
Browse files Browse the repository at this point in the history
* Add a new synthetics step detail page for displaying waterfall data
  • Loading branch information
Kerry350 committed Dec 14, 2020
1 parent 1e4ca4f commit 53df452
Show file tree
Hide file tree
Showing 44 changed files with 1,892 additions and 1,146 deletions.
2 changes: 2 additions & 0 deletions x-pack/plugins/uptime/common/constants/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const SETTINGS_ROUTE = '/settings';

export const CERTIFICATES_ROUTE = '/certificates';

export const STEP_DETAIL_ROUTE = '/journey/:checkGroupId/step/:stepIndex';

export enum STATUS {
UP = 'up',
DOWN = 'down',
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/uptime/common/runtime_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export * from './monitor';
export * from './overview_filters';
export * from './ping';
export * from './snapshot';
export * from './network_events';
48 changes: 48 additions & 0 deletions x-pack/plugins/uptime/common/runtime_types/network_events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import * as t from 'io-ts';

const NetworkTimingsType = t.type({
queueing: t.number,
connect: t.number,
total: t.number,
send: t.number,
blocked: t.number,
receive: t.number,
wait: t.number,
dns: t.number,
proxy: t.number,
ssl: t.number,
});

export type NetworkTimings = t.TypeOf<typeof NetworkTimingsType>;

const NetworkEventType = t.intersection([
t.type({
timestamp: t.string,
requestSentTime: t.number,
loadEndTime: t.number,
}),
t.partial({
method: t.string,
url: t.string,
status: t.number,
mimeType: t.string,
requestStartTime: t.number,
timings: NetworkTimingsType,
}),
]);

export type NetworkEvent = t.TypeOf<typeof NetworkEventType>;

export const SyntheticsNetworkEventsApiResponseType = t.type({
events: t.array(NetworkEventType),
});

export type SyntheticsNetworkEventsApiResponse = t.TypeOf<
typeof SyntheticsNetworkEventsApiResponseType
>;
30 changes: 26 additions & 4 deletions x-pack/plugins/uptime/common/runtime_types/ping/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,32 @@ export const PingType = t.intersection([
}),
]);

export const SyntheticsJourneyApiResponseType = t.type({
checkGroup: t.string,
steps: t.array(PingType),
});
export const SyntheticsJourneyApiResponseType = t.intersection([
t.type({
checkGroup: t.string,
steps: t.array(PingType),
}),
t.partial({
details: t.union([
t.intersection([
t.type({
timestamp: t.string,
}),
t.partial({
next: t.type({
timestamp: t.string,
checkGroup: t.string,
}),
previous: t.type({
timestamp: t.string,
checkGroup: t.string,
}),
}),
]),
t.null,
]),
}),
]);

export type SyntheticsJourneyApiResponse = t.TypeOf<typeof SyntheticsJourneyApiResponseType>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ import { useRouteMatch } from 'react-router-dom';
import { UptimeDatePicker } from '../uptime_date_picker';
import { SyntheticsCallout } from '../../overview/synthetics_callout';
import { PageTabs } from './page_tabs';
import { CERTIFICATES_ROUTE, MONITOR_ROUTE, SETTINGS_ROUTE } from '../../../../common/constants';
import {
CERTIFICATES_ROUTE,
MONITOR_ROUTE,
SETTINGS_ROUTE,
STEP_DETAIL_ROUTE,
} from '../../../../common/constants';
import { CertRefreshBtn } from '../../certificates/cert_refresh_btn';
import { ToggleAlertFlyoutButton } from '../../overview/alerts/alerts_containers';

Expand All @@ -34,11 +39,12 @@ const StyledPicker = styled(EuiFlexItem)`
export const PageHeader = () => {
const isCertRoute = useRouteMatch(CERTIFICATES_ROUTE);
const isSettingsRoute = useRouteMatch(SETTINGS_ROUTE);
const isStepDetailRoute = useRouteMatch(STEP_DETAIL_ROUTE);

const DatePickerComponent = () =>
isCertRoute ? (
<CertRefreshBtn />
) : (
) : isStepDetailRoute ? null : (
<StyledPicker grow={false} style={{ flexBasis: 485 }}>
<UptimeDatePicker />
</StyledPicker>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React, { FC } from 'react';
import { EuiLink } from '@elastic/eui';
import { Link } from 'react-router-dom';

interface StepDetailLinkProps {
/**
* The ID of the check group (the journey run)
*/
checkGroupId: string;
/**
* The index of the step
*/
stepIndex: number;
}

export const StepDetailLink: FC<StepDetailLinkProps> = ({ children, checkGroupId, stepIndex }) => {
const to = `/journey/${checkGroupId}/step/${stepIndex}`;

return (
<EuiLink>
<Link data-test-subj={`step-detail-link`} to={to}>
{children}
</Link>
</EuiLink>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ describe('ExecutedJourney component', () => {
direction="column"
>
<ExecutedStep
checkGroup="check_group"
index={0}
key="0"
step={
Expand All @@ -230,6 +231,7 @@ describe('ExecutedJourney component', () => {
}
/>
<ExecutedStep
checkGroup="check_group"
index={1}
key="1"
step={
Expand Down
Loading

0 comments on commit 53df452

Please sign in to comment.