Skip to content

Commit 46e1b78

Browse files
[APM][Unified Waterfall] Enable telemetry by removing unnecessary stopPropagation calls and updating data-test-subj attributes (#229182)
## Summary Relates to #225472 While building the Unified Waterfall, part of the code was inspired by the APM waterfall, and there were some `e.stopPropagation` calls that were no longer needed and they were preventing the click event from reaching our EBT. To bring those events back and enable telemetry analysis on waterfall usage, the `e.stopPropagation` calls have been removed, and a few `data-test-subj` attributes have been renamed and/or added. A minor UI issue with the dependency field was also detected and fixed along the way. |Before|After| |-|-| |<img width="1317" height="969" alt="Screenshot 2025-07-23 at 17 26 11" src="https://github.com/user-attachments/assets/bfea8171-9430-4480-9664-65d1e6780c61" />|<img width="1317" height="965" alt="Screenshot 2025-07-23 at 17 28 27" src="https://github.com/user-attachments/assets/46ddac58-c723-4ab2-82b7-b6d9ee9996b5" />| ## How to test - Go to Discover in an Observability Solution space - Query traces (`FROM traces-*`) - Open any span/transaction flyout - Open the full screen waterfall - Open flyout from the waterfall - Check for the sent events, we now have clicks --------- Co-authored-by: Cauê Marcondes <55978943+cauemarcondes@users.noreply.github.com>
1 parent 4d106ec commit 46e1b78

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

src/platform/plugins/shared/unified_doc_viewer/public/components/observability/traces/doc_viewer_span_overview/sub_components/dependency_name_link.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function DependencyNameLink({
6969

7070
const content = (
7171
<EuiFlexGroup gutterSize="xs" alignItems="center">
72-
<EuiFlexItem>
72+
<EuiFlexItem grow={false}>
7373
<SpanIcon type={spanType} subtype={spanSubtype} size="m" />
7474
</EuiFlexItem>
7575
<EuiFlexItem>{formattedDependencyName}</EuiFlexItem>

x-pack/solutions/observability/plugins/apm/public/components/shared/trace_waterfall/toggle_accordion_button.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import React from 'react';
99
import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText, EuiToolTip } from '@elastic/eui';
10+
import { i18n } from '@kbn/i18n';
1011
import { asBigNumber } from '../../../../common/utils/formatters';
1112

1213
export const TOGGLE_BUTTON_WIDTH = 20;
@@ -23,17 +24,22 @@ export function ToggleAccordionButton({ isOpen, childrenCount, onClick }: Props)
2324
justifyContent="center"
2425
responsive={false}
2526
css={{ position: 'relative', width: `${TOGGLE_BUTTON_WIDTH}px` }}
27+
data-test-subj="toggleAccordionButton"
28+
onClick={onClick}
29+
onKeyDown={(e) => {
30+
if (onClick && (e.key === 'Enter' || e.key === ' ')) {
31+
e.preventDefault(); // Prevent scroll if Space is pressed
32+
onClick();
33+
}
34+
}}
35+
tabIndex={0}
36+
role="button"
37+
aria-label={i18n.translate('xpack.apm.toggleAccordionButton', {
38+
defaultMessage: 'Toggle accordion',
39+
})}
2640
>
2741
<EuiFlexItem grow={false}>
28-
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
29-
<div
30-
onClick={(e) => {
31-
e.stopPropagation();
32-
onClick();
33-
}}
34-
>
35-
<EuiIcon type={isOpen ? 'arrowDown' : 'arrowRight'} />
36-
</div>
42+
<EuiIcon type={isOpen ? 'arrowDown' : 'arrowRight'} />
3743
</EuiFlexItem>
3844
<EuiFlexItem grow={false}>
3945
<div

x-pack/solutions/observability/plugins/apm/public/components/shared/trace_waterfall/trace_item_row.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ export function TraceItemRow({ item, childrenCount, state, onToggle }: Props) {
5050
<>
5151
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
5252
<div
53+
data-test-subj="traceItemRowWrapper"
5354
css={css`
5455
border-bottom: ${euiTheme.border.thin};
5556
${onClick || hasToggle ? 'cursor: pointer;' : 'cursor: default'}
5657
`}
57-
onClick={(e: React.MouseEvent) => {
58+
onClick={() => {
5859
if (!hasToggle && onClick) {
59-
e.stopPropagation();
6060
onClick(item.id);
6161
}
6262
}}
@@ -82,6 +82,7 @@ export function TraceItemRow({ item, childrenCount, state, onToggle }: Props) {
8282
{hasToggle ? (
8383
<EuiFlexItem grow={false}>
8484
<ToggleAccordionButton
85+
data-test-subj="traceItemRowToggleAccordionButton"
8586
isOpen={state === 'open'}
8687
childrenCount={childrenCount}
8788
onClick={() => onToggle(item.id)}
@@ -90,13 +91,12 @@ export function TraceItemRow({ item, childrenCount, state, onToggle }: Props) {
9091
) : null}
9192
<EuiFlexItem>
9293
<div
93-
data-test-subj="trace-bar-row"
94+
data-test-subj="traceItemRowContent"
9495
css={css`
9596
margin-left: ${calculateMarginLeft()}px;
9697
`}
97-
onClick={(e: React.MouseEvent) => {
98+
onClick={() => {
9899
if (hasToggle && onClick) {
99-
e.stopPropagation();
100100
onClick(item.id);
101101
}
102102
}}
@@ -142,11 +142,6 @@ export function TraceItemRow({ item, childrenCount, state, onToggle }: Props) {
142142
paddingSize="none"
143143
forceState={state}
144144
arrowDisplay="none"
145-
onToggle={() => {
146-
if (hasToggle) {
147-
onToggle(item.id);
148-
}
149-
}}
150145
buttonContentClassName="accordion__buttonContent"
151146
css={css`
152147
.accordion__buttonContent {

0 commit comments

Comments
 (0)