Skip to content

Commit edfae05

Browse files
[APM] Service overview: Introduce time-series comparison (#88665) (#88948)
* adding comparision select option * adding time comparison field on some pages * removing unused files * fixing unit test * adding unit tests * enabling comparison for more than 8 days * removing tooltip * refactoring search bar * moving useBreakPoint to common hooks folder, removing useShouldUSeMobileLayout hook * addressing PR comments * addressing PR comments * addressing PR comments * addressing PR comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent 231a001 commit edfae05

16 files changed

Lines changed: 344 additions & 46 deletions

File tree

x-pack/plugins/apm/public/components/app/RumDashboard/RumDashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { UXMetrics } from './UXMetrics';
1818
import { ImpactfulMetrics } from './ImpactfulMetrics';
1919
import { PageLoadAndViews } from './Panels/PageLoadAndViews';
2020
import { VisitorBreakdownsPanel } from './Panels/VisitorBreakdowns';
21-
import { useBreakPoints } from './hooks/useBreakPoints';
21+
import { useBreakPoints } from '../../../hooks/use_break_points';
2222
import { getPercentileLabel } from './UXMetrics/translations';
2323
import { useUrlParams } from '../../../context/url_params_context/use_url_params';
2424

x-pack/plugins/apm/public/components/app/TransactionDetails/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function TransactionDetails({
113113
<h1>{transactionName}</h1>
114114
</EuiTitle>
115115
</ApmHeader>
116-
<SearchBar />
116+
<SearchBar showTimeComparison />
117117
<EuiPage>
118118
<EuiFlexGroup>
119119
<EuiFlexItem grow={1}>

x-pack/plugins/apm/public/components/app/service_inventory/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export function ServiceInventory() {
129129

130130
return (
131131
<>
132-
<SearchBar />
132+
<SearchBar showTimeComparison />
133133
<EuiPage>
134134
<EuiFlexGroup>
135135
<EuiFlexItem grow={1}>

x-pack/plugins/apm/public/components/app/service_inventory/service_inventory.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ function wrapper({ children }: { children?: ReactNode }) {
5757
rangeTo: 'now',
5858
start: 'mystart',
5959
end: 'myend',
60+
comparisonEnabled: true,
61+
comparisonType: 'yesterday',
6062
}}
6163
>
6264
{children}

x-pack/plugins/apm/public/components/app/service_overview/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { isRumAgentName } from '../../../../common/agent_name';
1212
import { AnnotationsContextProvider } from '../../../context/annotations/annotations_context';
1313
import { useApmServiceContext } from '../../../context/apm_service/use_apm_service_context';
1414
import { ChartPointerEventContextProvider } from '../../../context/chart_pointer_event/chart_pointer_event_context';
15+
import { useBreakPoints } from '../../../hooks/use_break_points';
1516
import { LatencyChart } from '../../shared/charts/latency_chart';
1617
import { TransactionBreakdownChart } from '../../shared/charts/transaction_breakdown_chart';
1718
import { TransactionErrorRateChart } from '../../shared/charts/transaction_error_rate_chart';
@@ -22,7 +23,6 @@ import { ServiceOverviewErrorsTable } from './service_overview_errors_table';
2223
import { ServiceOverviewInstancesTable } from './service_overview_instances_table';
2324
import { ServiceOverviewThroughputChart } from './service_overview_throughput_chart';
2425
import { ServiceOverviewTransactionsTable } from './service_overview_transactions_table';
25-
import { useShouldUseMobileLayout } from './use_should_use_mobile_layout';
2626

2727
/**
2828
* The height a chart should be if it's next to a table with 5 rows and a title.
@@ -44,8 +44,8 @@ export function ServiceOverview({
4444

4545
// The default EuiFlexGroup breaks at 768, but we want to break at 992, so we
4646
// observe the window width and set the flex directions of rows accordingly
47-
const shouldUseMobileLayout = useShouldUseMobileLayout();
48-
const rowDirection = shouldUseMobileLayout ? 'column' : 'row';
47+
const { isMedium } = useBreakPoints();
48+
const rowDirection = isMedium ? 'column' : 'row';
4949

5050
const { transactionType } = useApmServiceContext();
5151
const transactionTypeLabel = i18n.translate(
@@ -57,7 +57,7 @@ export function ServiceOverview({
5757
return (
5858
<AnnotationsContextProvider>
5959
<ChartPointerEventContextProvider>
60-
<SearchBar prepend={transactionTypeLabel} />
60+
<SearchBar prepend={transactionTypeLabel} showTimeComparison />
6161
<EuiPage>
6262
<EuiFlexGroup direction="column" gutterSize="s">
6363
{isRumAgent && (

x-pack/plugins/apm/public/components/app/service_overview/service_overview_table_container.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import React, { ReactNode } from 'react';
88
import styled from 'styled-components';
9-
import { useShouldUseMobileLayout } from './use_should_use_mobile_layout';
9+
import { useBreakPoints } from '../../../hooks/use_break_points';
1010

1111
/**
1212
* The height for a table on the overview page. Is the height of a 5-row basic
@@ -58,12 +58,12 @@ export function ServiceOverviewTableContainer({
5858
children?: ReactNode;
5959
isEmptyAndLoading: boolean;
6060
}) {
61-
const shouldUseMobileLayout = useShouldUseMobileLayout();
61+
const { isMedium } = useBreakPoints();
6262

6363
return (
6464
<ServiceOverviewTableContainerDiv
6565
isEmptyAndLoading={isEmptyAndLoading}
66-
shouldUseMobileLayout={shouldUseMobileLayout}
66+
shouldUseMobileLayout={isMedium}
6767
>
6868
{children}
6969
</ServiceOverviewTableContainerDiv>

x-pack/plugins/apm/public/components/app/service_overview/use_should_use_mobile_layout.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

x-pack/plugins/apm/public/components/app/transaction_overview/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function TransactionOverview({ serviceName }: TransactionOverviewProps) {
108108

109109
return (
110110
<>
111-
<SearchBar />
111+
<SearchBar showTimeComparison />
112112

113113
<EuiPage>
114114
<EuiFlexGroup>

x-pack/plugins/apm/public/components/app/transaction_overview/transaction_overview.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('TransactionOverview', () => {
130130
});
131131

132132
expect(history.location.search).toEqual(
133-
'?transactionType=secondType&rangeFrom=now-15m&rangeTo=now'
133+
'?transactionType=secondType&rangeFrom=now-15m&rangeTo=now&comparisonEnabled=true&comparisonType=yesterday'
134134
);
135135
expect(getByText(container, 'firstType')).toBeInTheDocument();
136136
expect(getByText(container, 'secondType')).toBeInTheDocument();
@@ -139,7 +139,7 @@ describe('TransactionOverview', () => {
139139

140140
expect(history.push).toHaveBeenCalled();
141141
expect(history.location.search).toEqual(
142-
'?transactionType=firstType&rangeFrom=now-15m&rangeTo=now'
142+
'?transactionType=firstType&rangeFrom=now-15m&rangeTo=now&comparisonEnabled=true&comparisonType=yesterday'
143143
);
144144
});
145145
});

x-pack/plugins/apm/public/components/shared/Links/url_helpers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ export type APMQueryParams = {
8585
searchTerm?: string;
8686
percentile?: 50 | 75 | 90 | 95 | 99;
8787
latencyAggregationType?: string;
88+
comparisonEnabled?: boolean;
89+
comparisonType?: string;
8890
} & { [key in LocalUIFilterName]?: string };
8991

9092
// forces every value of T[K] to be type: string

0 commit comments

Comments
 (0)