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

[APM] Latency chart for overview #84634

Merged
merged 33 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
15f6d61
adding latency chart
cauemarcondes Nov 30, 2020
021b538
adding loading indicator
cauemarcondes Dec 1, 2020
912b194
fixing unit test
cauemarcondes Dec 1, 2020
da29adb
fixing y-axis format
cauemarcondes Dec 1, 2020
f111ab4
fixing some stuff
cauemarcondes Dec 3, 2020
1c9f735
using urlhelpers
cauemarcondes Dec 3, 2020
adf44f5
adding latency aggregation type on the transactions overview api
cauemarcondes Dec 4, 2020
6af89d9
fixing transaction group overview route
cauemarcondes Dec 8, 2020
e7ed954
fixing merge problems
cauemarcondes Dec 8, 2020
91491e7
breaking /transactions/charts into /latency and /thoughput
cauemarcondes Dec 7, 2020
f131356
adding unit tests
cauemarcondes Dec 7, 2020
49ddef7
fixing UI
cauemarcondes Dec 8, 2020
a6f4e28
fixing i18n
cauemarcondes Dec 8, 2020
292d57b
addressing pr comments
cauemarcondes Dec 8, 2020
cec2f84
fix api test
cauemarcondes Dec 8, 2020
345e261
refactoring some stuff
cauemarcondes Dec 8, 2020
a714c11
Merge branch 'apm-refactoring-transactions-charts' of github.com:caue…
cauemarcondes Dec 8, 2020
f12bf04
addressing pr comments
cauemarcondes Dec 9, 2020
85efe71
addressing pr comments
cauemarcondes Dec 9, 2020
08ba135
Merge branch 'master' of github.com:elastic/kibana into apm-refactori…
cauemarcondes Dec 9, 2020
0502bc5
Merge branch 'apm-refactoring-transactions-charts' of github.com:caue…
cauemarcondes Dec 9, 2020
3d23717
adding latecy chart
cauemarcondes Dec 9, 2020
04d8b0a
fixing test
cauemarcondes Dec 9, 2020
ee1c8a6
Merge branch 'apm-refactoring-transactions-charts' of github.com:caue…
cauemarcondes Dec 9, 2020
8308753
fixing api tests
cauemarcondes Dec 9, 2020
c65fe08
Merge branch 'master' of github.com:elastic/kibana into apm-overview-…
cauemarcondes Dec 10, 2020
ebeea72
fixing api test
cauemarcondes Dec 10, 2020
9f8f561
Merge branch 'master' of github.com:elastic/kibana into apm-overview-…
cauemarcondes Dec 10, 2020
bb0d74b
fixing build
cauemarcondes Dec 10, 2020
9527e06
addressing pr comments
cauemarcondes Dec 10, 2020
2094620
Merge branch 'master' into apm-overview-latency
kibanamachine Dec 14, 2020
f798d49
addressing pr comments
cauemarcondes Dec 14, 2020
2d89e43
refactoring some stuff
cauemarcondes Dec 14, 2020
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
18 changes: 18 additions & 0 deletions x-pack/plugins/apm/common/latency_aggregation_types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* 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';

export enum LatencyAggregationType {
avg = 'avg',
p99 = 'p99',
p95 = 'p95',
}

export const latencyAggregationTypeRt = t.union([
t.literal('avg'),
t.literal('p95'),
t.literal('p99'),
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
]);
185 changes: 92 additions & 93 deletions x-pack/plugins/apm/public/components/app/service_overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ import { i18n } from '@kbn/i18n';
import React from 'react';
import { useTrackPageview } from '../../../../../observability/public';
import { isRumAgentName } from '../../../../common/agent_name';
import { AnnotationsContextProvider } from '../../../context/annotations/annotations_context';
import { ChartPointerEventContextProvider } from '../../../context/chart_pointer_event/chart_pointer_event_context';
import { LatencyChart } from '../../shared/charts/latency_chart';
import { TransactionBreakdownChart } from '../../shared/charts/transaction_breakdown_chart';
import { TransactionErrorRateChart } from '../../shared/charts/transaction_error_rate_chart';
import { SearchBar } from '../../shared/search_bar';
import { ServiceOverviewErrorsTable } from './service_overview_errors_table';
import { ServiceOverviewDependenciesTable } from './service_overview_dependencies_table';
import { ServiceOverviewErrorsTable } from './service_overview_errors_table';
import { ServiceOverviewThroughputChart } from './service_overview_throughput_chart';
import { ServiceOverviewTransactionsTable } from './service_overview_transactions_table';

Expand All @@ -43,99 +45,96 @@ export function ServiceOverview({
useTrackPageview({ app: 'apm', path: 'service_overview', delay: 15000 });

return (
<ChartPointerEventContextProvider>
<SearchBar />
<EuiPage>
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexItem>
<EuiPanel>
<EuiTitle size="xs">
<h2>
{i18n.translate(
'xpack.apm.serviceOverview.latencyChartTitle',
{
defaultMessage: 'Latency',
}
)}
</h2>
</EuiTitle>
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={4}>
<ServiceOverviewThroughputChart height={chartHeight} />
</EuiFlexItem>
<EuiFlexItem grow={6}>
<EuiPanel>
<ServiceOverviewTransactionsTable serviceName={serviceName} />
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup gutterSize="s">
{!isRumAgentName(agentName) && (
<AnnotationsContextProvider>
<ChartPointerEventContextProvider>
<SearchBar />
<EuiPage>
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexItem>
<EuiPanel>
<LatencyChart height={200} />
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={4}>
<ServiceOverviewThroughputChart height={chartHeight} />
</EuiFlexItem>
<EuiFlexItem grow={6}>
<EuiPanel>
<ServiceOverviewTransactionsTable
serviceName={serviceName}
/>
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup gutterSize="s">
{!isRumAgentName(agentName) && (
<EuiFlexItem grow={4}>
<TransactionErrorRateChart
height={chartHeight}
showAnnotations={false}
/>
</EuiFlexItem>
)}
<EuiFlexItem grow={6}>
<EuiPanel>
<ServiceOverviewErrorsTable serviceName={serviceName} />
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={4}>
<TransactionErrorRateChart
height={chartHeight}
showAnnotations={false}
/>
<TransactionBreakdownChart showAnnotations={false} />
</EuiFlexItem>
<EuiFlexItem grow={6}>
<EuiPanel>
<ServiceOverviewDependenciesTable
serviceName={serviceName}
/>
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={4}>
<EuiPanel>
<EuiTitle size="xs">
<h2>
{i18n.translate(
'xpack.apm.serviceOverview.instancesLatencyDistributionChartTitle',
{
defaultMessage: 'Instances latency distribution',
}
)}
</h2>
</EuiTitle>
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem grow={6}>
<EuiPanel>
<EuiTitle size="xs">
<h2>
{i18n.translate(
'xpack.apm.serviceOverview.instancesTableTitle',
{
defaultMessage: 'Instances',
}
)}
</h2>
</EuiTitle>
</EuiPanel>
</EuiFlexItem>
)}
<EuiFlexItem grow={6}>
<EuiPanel>
<ServiceOverviewErrorsTable serviceName={serviceName} />
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={4}>
<TransactionBreakdownChart showAnnotations={false} />
</EuiFlexItem>
<EuiFlexItem grow={6}>
<EuiPanel>
<ServiceOverviewDependenciesTable serviceName={serviceName} />
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={4}>
<EuiPanel>
<EuiTitle size="xs">
<h2>
{i18n.translate(
'xpack.apm.serviceOverview.instancesLatencyDistributionChartTitle',
{
defaultMessage: 'Instances latency distribution',
}
)}
</h2>
</EuiTitle>
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem grow={6}>
<EuiPanel>
<EuiTitle size="xs">
<h2>
{i18n.translate(
'xpack.apm.serviceOverview.instancesTableTitle',
{
defaultMessage: 'Instances',
}
)}
</h2>
</EuiTitle>
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPage>
</ChartPointerEventContextProvider>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPage>
</ChartPointerEventContextProvider>
</AnnotationsContextProvider>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import React, { useState } from 'react';
import styled from 'styled-components';
import { EuiToolTip } from '@elastic/eui';
import { ValuesType } from 'utility-types';
import { useLatencyAggregationType } from '../../../../hooks/use_latency_Aggregation_type';
import { LatencyAggregationType } from '../../../../../common/latency_aggregation_types';
import {
asDuration,
asPercent,
Expand Down Expand Up @@ -64,9 +66,39 @@ const StyledTransactionDetailLink = styled(TransactionDetailLink)`
${truncate('100%')}
`;

export function ServiceOverviewTransactionsTable(props: Props) {
const { serviceName } = props;
function getLatencyAggregationTypeLabel(
latencyAggregationType?: LatencyAggregationType
) {
switch (latencyAggregationType) {
case 'p95': {
return i18n.translate(
'xpack.apm.serviceOverview.transactionsTableColumnLatency.p95',
{
defaultMessage: 'Latency (95th)',
}
);
}
case 'p99': {
return i18n.translate(
'xpack.apm.serviceOverview.transactionsTableColumnLatency.p99',
{
defaultMessage: 'Latency (99th)',
}
);
}
default: {
return i18n.translate(
'xpack.apm.serviceOverview.transactionsTableColumnLatency.avg',
{
defaultMessage: 'Latency (avg.)',
}
);
}
}
}

export function ServiceOverviewTransactionsTable({ serviceName }: Props) {
const latencyAggregationType = useLatencyAggregationType();
const {
uiFilters,
urlParams: { start, end },
Expand Down Expand Up @@ -94,7 +126,7 @@ export function ServiceOverviewTransactionsTable(props: Props) {
},
status,
} = useFetcher(() => {
if (!start || !end) {
if (!start || !end || !latencyAggregationType) {
return;
}

Expand All @@ -112,6 +144,7 @@ export function ServiceOverviewTransactionsTable(props: Props) {
pageIndex: tableOptions.pageIndex,
sortField: tableOptions.sort.field,
sortDirection: tableOptions.sort.direction,
latencyAggregationType,
},
},
}).then((response) => {
Expand All @@ -135,6 +168,7 @@ export function ServiceOverviewTransactionsTable(props: Props) {
tableOptions.pageIndex,
tableOptions.sort.field,
tableOptions.sort.direction,
latencyAggregationType,
]);

const {
Expand Down Expand Up @@ -170,12 +204,7 @@ export function ServiceOverviewTransactionsTable(props: Props) {
},
{
field: 'latency',
name: i18n.translate(
'xpack.apm.serviceOverview.transactionsTableColumnLatency',
{
defaultMessage: 'Latency',
}
),
name: getLatencyAggregationTypeLabel(latencyAggregationType),
width: px(unit * 10),
render: (_, { latency }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const PERSISTENT_APM_PARAMS: Array<keyof APMQueryParams> = [
*/
export function useAPMHref(
path: string,
persistentFilters: Array<keyof APMQueryParams> = PERSISTENT_APM_PARAMS
persistentFilters: Array<keyof APMQueryParams> = []
) {
const { urlParams } = useUrlParams();
const { basePath } = useApmPluginContext().core.http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const persistedFilters: Array<keyof APMQueryParams> = [
'containerId',
'podName',
'serviceVersion',
'latencyAggregationType',
];

export function useTransactionOverviewHref(serviceName: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,34 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { useUrlParams } from '../../../../context/url_params_context/use_url_params';
import { pickKeys } from '../../../../../common/utils/pick_keys';
import { APMQueryParams } from '../url_helpers';
import { APMLink, APMLinkExtendProps, useAPMHref } from './APMLink';

interface ServiceOverviewLinkProps extends APMLinkExtendProps {
serviceName: string;
}

const persistedFilters: Array<keyof APMQueryParams> = [
'latencyAggregationType',
];

export function useServiceOverviewHref(serviceName: string) {
return useAPMHref(`/services/${serviceName}/overview`);
return useAPMHref(`/services/${serviceName}/overview`, persistedFilters);
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
}

export function ServiceOverviewLink({
serviceName,
...rest
}: ServiceOverviewLinkProps) {
return <APMLink path={`/services/${serviceName}/overview`} {...rest} />;
const { urlParams } = useUrlParams();

return (
<APMLink
path={`/services/${serviceName}/overview`}
query={pickKeys(urlParams as APMQueryParams, ...persistedFilters)}
{...rest}
/>
);
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { History } from 'history';
import { parse, stringify } from 'query-string';
import { LatencyAggregationType } from '../../../../common/latency_aggregation_types';
import { url } from '../../../../../../../src/plugins/kibana_utils/public';
import { LocalUIFilterName } from '../../../../common/ui_filter';

Expand Down Expand Up @@ -84,6 +85,7 @@ export type APMQueryParams = {
refreshInterval?: string | number;
searchTerm?: string;
percentile?: 50 | 75 | 90 | 95 | 99;
latencyAggregationType?: LatencyAggregationType;
} & { [key in LocalUIFilterName]?: string };

// forces every value of T[K] to be type: string
Expand Down
Loading