Skip to content

Commit 4868f66

Browse files
authored
Adds UI notification for dropped spans (#25017) (#25581)
* Adds icon and tooltip for dropped spans * Adds callout and style in transaction flyout instead of timeline for dropped spans message * Review tweaks and linting fixes
1 parent 25a3892 commit 4868f66

File tree

2 files changed

+69
-7
lines changed
  • x-pack/plugins/apm/public
    • components/app/TransactionDetails/Transaction/WaterfallContainer/Waterfall/TransactionFlyout
    • utils/documentation

2 files changed

+69
-7
lines changed

x-pack/plugins/apm/public/components/app/TransactionDetails/Transaction/WaterfallContainer/Waterfall/TransactionFlyout/index.tsx

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@
66

77
import {
88
EuiButtonEmpty,
9+
EuiCallOut,
910
EuiFlexGroup,
1011
EuiFlexItem,
1112
EuiFlyout,
1213
EuiFlyoutBody,
1314
EuiFlyoutHeader,
1415
EuiHorizontalRule,
16+
EuiLink,
1517
EuiPortal,
1618
EuiTitle
1719
} from '@elastic/eui';
20+
import { get } from 'lodash';
1821
import React from 'react';
22+
import styled from 'styled-components';
1923
import { IUrlParams } from 'x-pack/plugins/apm/public/store/urlParams';
24+
import { APM_AGENT_DROPPED_SPANS_DOCS } from 'x-pack/plugins/apm/public/utils/documentation/agents';
2025
import { Transaction } from 'x-pack/plugins/apm/typings/Transaction';
2126
import { DiscoverTransactionLink } from '../../../ActionMenu';
2227
import { StickyTransactionProperties } from '../../../StickyTransactionProperties';
@@ -32,6 +37,61 @@ interface Props {
3237
waterfall: IWaterfall;
3338
}
3439

40+
const ResponsiveFlyout = styled(EuiFlyout)`
41+
width: 100%;
42+
43+
@media (min-width: 800px) {
44+
width: 90%;
45+
}
46+
47+
@media (min-width: 1000px) {
48+
width: 70%;
49+
}
50+
51+
@media (min-width: 1400px) {
52+
width: 50%;
53+
}
54+
55+
@media (min-width: 2000px) {
56+
width: 35%;
57+
}
58+
`;
59+
60+
function DroppedSpansWarning({
61+
transactionDoc
62+
}: {
63+
transactionDoc: Transaction;
64+
}) {
65+
const dropped: number = get(
66+
transactionDoc,
67+
'transaction.span_count.dropped.total',
68+
0
69+
);
70+
71+
if (dropped === 0) {
72+
return null;
73+
}
74+
75+
const url =
76+
APM_AGENT_DROPPED_SPANS_DOCS[transactionDoc.context.service.agent.name];
77+
78+
const docsLink = url ? (
79+
<EuiLink href={url} target="_blank">
80+
Learn more.
81+
</EuiLink>
82+
) : null;
83+
84+
return (
85+
<React.Fragment>
86+
<EuiCallOut size="s">
87+
The APM agent that reported this transaction dropped {dropped} spans or
88+
more based on its configuration. {docsLink}
89+
</EuiCallOut>
90+
<EuiHorizontalRule />
91+
</React.Fragment>
92+
);
93+
}
94+
3595
export function TransactionFlyout({
3696
transaction: transactionDoc,
3797
onClose,
@@ -45,7 +105,7 @@ export function TransactionFlyout({
45105

46106
return (
47107
<EuiPortal>
48-
<EuiFlyout onClose={onClose} size="m" ownFocus={true}>
108+
<ResponsiveFlyout onClose={onClose} ownFocus={true} maxWidth={false}>
49109
<EuiFlyoutHeader hasBorder>
50110
<EuiFlexGroup>
51111
<EuiFlexItem grow={false}>
@@ -71,13 +131,14 @@ export function TransactionFlyout({
71131
totalDuration={waterfall.traceRootDuration}
72132
/>
73133
<EuiHorizontalRule />
134+
<DroppedSpansWarning transactionDoc={transactionDoc} />
74135
<TransactionPropertiesTableForFlyout
75136
transaction={transactionDoc}
76137
location={location}
77138
urlParams={urlParams}
78139
/>
79140
</EuiFlyoutBody>
80-
</EuiFlyout>
141+
</ResponsiveFlyout>
81142
</EuiPortal>
82143
);
83144
}

x-pack/plugins/apm/public/utils/documentation/agents.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66

77
const AGENT_URL_ROOT = 'https://www.elastic.co/guide/en/apm/agent';
88

9-
// TODO: currently unused but should be added to timeline view
10-
export const APM_AGENT_DROPPED_SPANS_DOCS = {
9+
interface AgentNamedValues {
10+
[agentName: string]: string;
11+
}
12+
13+
export const APM_AGENT_DROPPED_SPANS_DOCS: AgentNamedValues = {
1114
nodejs: `${AGENT_URL_ROOT}/nodejs/1.x/agent-api.html#transaction-max-spans`,
1215
python: `${AGENT_URL_ROOT}/python/2.x/configuration.html#config-transaction-max-spans`
1316
};
1417

1518
const APM_AGENT_FEATURE_DOCS: {
16-
[featureName: string]: {
17-
[agentName: string]: string;
18-
};
19+
[featureName: string]: AgentNamedValues;
1920
} = {
2021
user: {
2122
java: `${AGENT_URL_ROOT}/java/0.7/public-api.html#api-transaction-set-user`,

0 commit comments

Comments
 (0)