Skip to content

Commit 0241423

Browse files
authored
[APM] Fix overlapping transaction names (#76083) (#76945)
...in the table and the header. Did this by adding `word-break: break-all` to them. Also: * Rename List to TransactionList * Add stories for TransactionList and ApmHeader * Add missing type information to transactions based on sample transaction Fixes #73960. # Conflicts: # x-pack/plugins/apm/typings/es_schemas/raw/fields/host.ts # x-pack/plugins/apm/typings/es_schemas/raw/fields/service.ts
1 parent 6624978 commit 0241423

File tree

12 files changed

+206
-21
lines changed

12 files changed

+206
-21
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { storiesOf } from '@storybook/react';
8+
import React from 'react';
9+
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
10+
import { TransactionGroup } from '../../../../../server/lib/transaction_groups/fetcher';
11+
import { TransactionList } from './';
12+
13+
storiesOf('app/TransactionOverview/TransactionList', module).add(
14+
'Single Row',
15+
() => {
16+
const items: TransactionGroup[] = [
17+
{
18+
name:
19+
'GET /api/v1/regions/azure-eastus2/clusters/elasticsearch/xc18de071deb4262be54baebf5f6a1ce/proxy/_snapshot/found-snapshots/_all',
20+
sample: {
21+
container: {
22+
id:
23+
'xa802046074071c9c828e8db3b7ef92ea0484d9fe783b9c518f65a7b45dfdd2c',
24+
},
25+
agent: {
26+
name: 'java',
27+
ephemeral_id: 'x787d6b7-3241-4b55-ba49-0c96bc9857d1',
28+
version: '1.17.0',
29+
},
30+
process: {
31+
pid: 28,
32+
title: '/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java',
33+
},
34+
processor: {
35+
name: 'transaction',
36+
event: 'transaction',
37+
},
38+
labels: {
39+
path:
40+
'/api/v1/regions/azure-eastus2/clusters/elasticsearch/xc18de071deb4262be54baebf5f6a1ce/proxy/_snapshot/found-snapshots/_all',
41+
status_code: '200',
42+
request_method: 'GET',
43+
request_id: 'x273dc2477e021979125e0ec67e8d778',
44+
},
45+
observer: {
46+
hostname: 'x840922c967b',
47+
name: 'instance-000000000x',
48+
id: 'xb384baf-c16a-415a-928a-a10635a04b81',
49+
ephemeral_id: 'x9227f0e-848d-423e-a65a-5fdee321f4a9',
50+
type: 'apm-server',
51+
version: '7.8.1',
52+
version_major: 7,
53+
},
54+
trace: {
55+
id: 'x998d7e5db84aa8341b358a264a78984',
56+
},
57+
'@timestamp': '2020-08-26T14:40:31.472Z',
58+
ecs: {
59+
version: '1.5.0',
60+
},
61+
service: {
62+
node: {
63+
name:
64+
'xa802046074071c9c828e8db3b7ef92ea0484d9fe783b9c518f65a7b45dfdd2c',
65+
},
66+
environment: 'qa',
67+
framework: {
68+
name: 'API',
69+
},
70+
name: 'adminconsole',
71+
runtime: {
72+
name: 'Java',
73+
version: '1.8.0_265',
74+
},
75+
language: {
76+
name: 'Java',
77+
version: '1.8.0_265',
78+
},
79+
version: 'ms-44.1-BC_1',
80+
},
81+
host: {
82+
hostname: 'xa8020460740',
83+
os: {
84+
platform: 'Linux',
85+
},
86+
ip: '3.83.239.24',
87+
name: 'xa8020460740',
88+
architecture: 'amd64',
89+
},
90+
transaction: {
91+
duration: {
92+
us: 8260617,
93+
},
94+
result: 'HTTP 2xx',
95+
name:
96+
'GET /api/v1/regions/azure-eastus2/clusters/elasticsearch/xc18de071deb4262be54baebf5f6a1ce/proxy/_snapshot/found-snapshots/_all',
97+
span_count: {
98+
dropped: 0,
99+
started: 8,
100+
},
101+
id: 'xaa3cae6fd4f7023',
102+
type: 'request',
103+
sampled: true,
104+
},
105+
timestamp: {
106+
us: 1598452831472001,
107+
},
108+
},
109+
p95: 11974156,
110+
averageResponseTime: 8087434.558974359,
111+
transactionsPerMinute: 0.40625,
112+
impact: 100,
113+
impactRelative: 100,
114+
},
115+
];
116+
117+
return <TransactionList isLoading={false} items={items} />;
118+
}
119+
);

x-pack/plugins/apm/public/components/app/TransactionOverview/List/index.tsx renamed to x-pack/plugins/apm/public/components/app/TransactionOverview/TransactionList/index.tsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,16 @@ import { LoadingStatePrompt } from '../../../shared/LoadingStatePrompt';
1919
import { EmptyMessage } from '../../../shared/EmptyMessage';
2020
import { TransactionDetailLink } from '../../../shared/Links/apm/TransactionDetailLink';
2121

22+
// Truncate both the link and the child span (the tooltip anchor.) The link so
23+
// it doesn't overflow, and the anchor so we get the ellipsis.
2224
const TransactionNameLink = styled(TransactionDetailLink)`
23-
${truncate('100%')};
2425
font-family: ${fontFamilyCode};
26+
white-space: nowrap;
27+
${truncate('100%')};
28+
29+
> span {
30+
${truncate('100%')};
31+
}
2532
`;
2633

2734
interface Props {
@@ -41,20 +48,20 @@ export function TransactionList({ items, isLoading }: Props) {
4148
sortable: true,
4249
render: (_, { sample }: TransactionGroup) => {
4350
return (
44-
<EuiToolTip
45-
id="transaction-name-link-tooltip"
46-
content={sample.transaction.name || NOT_AVAILABLE_LABEL}
51+
<TransactionNameLink
52+
serviceName={sample.service.name}
53+
transactionId={sample.transaction.id}
54+
traceId={sample.trace.id}
55+
transactionName={sample.transaction.name}
56+
transactionType={sample.transaction.type}
4757
>
48-
<TransactionNameLink
49-
serviceName={sample.service.name}
50-
transactionId={sample.transaction.id}
51-
traceId={sample.trace.id}
52-
transactionName={sample.transaction.name}
53-
transactionType={sample.transaction.type}
58+
<EuiToolTip
59+
id="transaction-name-link-tooltip"
60+
content={sample.transaction.name || NOT_AVAILABLE_LABEL}
5461
>
55-
{sample.transaction.name || NOT_AVAILABLE_LABEL}
56-
</TransactionNameLink>
57-
</EuiToolTip>
62+
<>{sample.transaction.name || NOT_AVAILABLE_LABEL}</>
63+
</EuiToolTip>
64+
</TransactionNameLink>
5865
);
5966
},
6067
},

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { ElasticDocsLink } from '../../shared/Links/ElasticDocsLink';
3333
import { fromQuery, toQuery } from '../../shared/Links/url_helpers';
3434
import { LocalUIFilters } from '../../shared/LocalUIFilters';
3535
import { TransactionTypeFilter } from '../../shared/LocalUIFilters/TransactionTypeFilter';
36-
import { TransactionList } from './List';
36+
import { TransactionList } from './TransactionList';
3737
import { useRedirect } from './useRedirect';
3838

3939
function getRedirectLocation({
@@ -62,6 +62,7 @@ function getRedirectLocation({
6262
export function TransactionOverview() {
6363
const location = useLocation();
6464
const { urlParams } = useUrlParams();
65+
6566
const { serviceName, transactionType } = urlParams;
6667

6768
// TODO: fetching of transaction types should perhaps be lifted since it is needed in several places. Context?
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { EuiTitle } from '@elastic/eui';
8+
import { storiesOf } from '@storybook/react';
9+
import React from 'react';
10+
import { MockApmPluginContextWrapper } from '../../../context/ApmPluginContext/MockApmPluginContext';
11+
import { ApmHeader } from './';
12+
13+
storiesOf('shared/ApmHeader', module)
14+
.addDecorator((storyFn) => {
15+
return (
16+
<MockApmPluginContextWrapper>{storyFn()}</MockApmPluginContextWrapper>
17+
);
18+
})
19+
.add('Example', () => {
20+
return (
21+
<ApmHeader>
22+
<EuiTitle size="l">
23+
<h1>
24+
GET
25+
/api/v1/regions/azure-eastus2/clusters/elasticsearch/xc18de071deb4262be54baebf5f6a1ce/proxy/_snapshot/found-snapshots/_all
26+
</h1>
27+
</EuiTitle>
28+
</ApmHeader>
29+
);
30+
});

x-pack/plugins/apm/public/components/shared/ApmHeader/index.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,25 @@
66

77
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
88
import React, { ReactNode } from 'react';
9-
import { KueryBar } from '../KueryBar';
9+
import styled from 'styled-components';
1010
import { DatePicker } from '../DatePicker';
1111
import { EnvironmentFilter } from '../EnvironmentFilter';
12+
import { KueryBar } from '../KueryBar';
13+
14+
// Header titles with long, unbroken words, like you would see for a long URL in
15+
// a transaction name, with the default `work-break`, don't break, and that ends
16+
// up pushing the date picker off of the screen. Setting `break-all` here lets
17+
// it wrap even if it has a long, unbroken work. The wrapped result is not great
18+
// looking, since it wraps, but it doesn't push any controls off of the screen.
19+
const ChildrenContainerFlexItem = styled(EuiFlexItem)`
20+
word-break: break-all;
21+
`;
1222

1323
export function ApmHeader({ children }: { children: ReactNode }) {
1424
return (
1525
<>
1626
<EuiFlexGroup alignItems="center" gutterSize="s">
17-
<EuiFlexItem>{children}</EuiFlexItem>
27+
<ChildrenContainerFlexItem>{children}</ChildrenContainerFlexItem>
1828
<EuiFlexItem grow={false}>
1929
<DatePicker />
2030
</EuiFlexItem>

x-pack/plugins/apm/server/lib/transaction_groups/fetcher.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,12 @@ export async function transactionGroupsFetcher(
185185
}
186186

187187
export interface TransactionGroup {
188-
key: Record<string, any> | string;
188+
name?: string;
189+
key?: Record<string, any> | string;
189190
averageResponseTime: number | null | undefined;
190191
transactionsPerMinute: number;
191192
p95: number | null | undefined;
192193
impact: number;
194+
impactRelative?: number;
193195
sample: Transaction;
194196
}

x-pack/plugins/apm/typings/es_schemas/raw/fields/host.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
*/
66

77
export interface Host {
8+
architecture?: string;
89
hostname?: string;
10+
name?: string;
11+
ip?: string;
12+
os?: {
13+
platform?: string;
14+
};
915
[key: string]: unknown;
1016
}

x-pack/plugins/apm/typings/es_schemas/raw/fields/observer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
*/
66

77
export interface Observer {
8+
ephemeral_id?: string;
9+
hostname?: string;
10+
id?: string;
811
name?: string;
12+
type?: string;
913
version: string;
1014
version_major: number;
1115
}

x-pack/plugins/apm/typings/es_schemas/raw/fields/process.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66

77
export interface Process {
8-
args: string[];
8+
args?: string[];
99
pid: number;
10-
ppid: number;
11-
title: string;
10+
ppid?: number;
11+
title?: string;
1212
}

x-pack/plugins/apm/typings/es_schemas/raw/fields/service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export interface Service {
99
environment?: string;
1010
framework?: {
1111
name: string;
12-
version: string;
12+
version?: string;
13+
};
14+
node?: {
15+
name?: string;
1316
};
1417
runtime?: {
1518
name: string;
@@ -19,5 +22,6 @@ export interface Service {
1922
name: string;
2023
version?: string;
2124
};
25+
version?: string;
2226
[key: string]: unknown;
2327
}

0 commit comments

Comments
 (0)