Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Synthetics] Waterfall view #84821

Merged
merged 15 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
56 changes: 56 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,56 @@
/*
* 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({
dns_start: t.number,
push_end: t.number,
worker_fetch_start: t.number,
worker_respond_with_settled: t.number,
proxy_end: t.number,
worker_start: t.number,
worker_ready: t.number,
send_end: t.number,
connect_end: t.number,
connect_start: t.number,
send_start: t.number,
proxy_start: t.number,
push_start: t.number,
ssl_end: t.number,
receive_headers_end: t.number,
ssl_start: t.number,
request_time: t.number,
dns_end: 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
@@ -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>
);
Comment on lines +25 to +31
Copy link
Contributor

Choose a reason for hiding this comment

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

This kills the purpose of EuiLink, we have a small utility for these kind of use cases,

can you please use that https://github.com/elastic/kibana/blob/master/x-pack/plugins/uptime/public/components/common/react_router_helpers/link_for_eui.tsx#L55

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can change it. I'd actually copied this style from here: https://github.com/elastic/kibana/blob/master/x-pack/plugins/uptime/public/components/common/monitor_page_link.tsx#L22, so maybe that needs changing too?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah we should change it there as well. i guess we can create a follow up issue to refactor all places in uptime.

};
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