Skip to content

Commit d28747d

Browse files
crespocarlosMiriamAparicioelasticmachine
authored
[8.19] [ObsUX][APM] Add tooltip for exit spans missing destination (#213714) (#219965)
# Backport This will backport the following commits from `main` to `8.19`: - [[ObsUX][APM] Add tooltip for exit spans missing destination (#213714)](#213714) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Miriam","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-03-13T08:45:56Z","message":"[ObsUX][APM] Add tooltip for exit spans missing destination (#213714)\n\nCloses https://github.com/elastic/kibana/issues/212638\n\n### Summary\n\nIn order to help users, support agents and engineers to spot eventual\nproblems on the Service Map, we want to display a warning on the exit\nspans that lack the span.destination.service.resource on the trace\nwaterfall.\n\n\n![image](https://github.com/user-attachments/assets/eee3f962-a91c-49bb-9f06-c989ed8500c5)","sha":"9fb25a155c9d88b0b23ac4264c6d38bead9f544b","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","Team:obs-ux-infra_services","v9.1.0","v8.19.0"],"title":"[ObsUX][APM] Add tooltip for exit spans missing destination","number":213714,"url":"https://github.com/elastic/kibana/pull/213714","mergeCommit":{"message":"[ObsUX][APM] Add tooltip for exit spans missing destination (#213714)\n\nCloses https://github.com/elastic/kibana/issues/212638\n\n### Summary\n\nIn order to help users, support agents and engineers to spot eventual\nproblems on the Service Map, we want to display a warning on the exit\nspans that lack the span.destination.service.resource on the trace\nwaterfall.\n\n\n![image](https://github.com/user-attachments/assets/eee3f962-a91c-49bb-9f06-c989ed8500c5)","sha":"9fb25a155c9d88b0b23ac4264c6d38bead9f544b"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/213714","number":213714,"mergeCommit":{"message":"[ObsUX][APM] Add tooltip for exit spans missing destination (#213714)\n\nCloses https://github.com/elastic/kibana/issues/212638\n\n### Summary\n\nIn order to help users, support agents and engineers to spot eventual\nproblems on the Service Map, we want to display a warning on the exit\nspans that lack the span.destination.service.resource on the trace\nwaterfall.\n\n\n![image](https://github.com/user-attachments/assets/eee3f962-a91c-49bb-9f06-c989ed8500c5)","sha":"9fb25a155c9d88b0b23ac4264c6d38bead9f544b"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Miriam <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
1 parent 4bae6fe commit d28747d

File tree

6 files changed

+49
-0
lines changed

6 files changed

+49
-0
lines changed

x-pack/solutions/observability/plugins/apm/common/waterfall/typings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export interface WaterfallSpan {
6363
sync?: boolean;
6464
duration: { us: number };
6565
links?: SpanLink[];
66+
destination?: { service?: { resource?: string } };
6667
};
6768
transaction?: {
6869
id?: string;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
import { EuiIcon, EuiToolTip } from '@elastic/eui';
8+
import React from 'react';
9+
import { i18n } from '@kbn/i18n';
10+
11+
export function SpanMissingDestinationTooltip() {
12+
return (
13+
<EuiToolTip
14+
title={i18n.translate('xpack.apm.waterfallItem.euiToolTip.spanMissingDestinationLabel', {
15+
defaultMessage: 'Missing destination',
16+
})}
17+
content={i18n.translate(
18+
'xpack.apm.waterfallItem.euiToolTip.spanMissingDestinationDescription',
19+
{
20+
defaultMessage:
21+
'This exit span is missing the span.destination.service.resource field which might prevent linking it to downstream transactions on features that depend on this information. i.e.: Service Map. Make sure the instrumentation of this exit span follows OTel Semantic Conventions',
22+
}
23+
)}
24+
>
25+
<EuiIcon type="warning" size="s" color="danger" />
26+
</EuiToolTip>
27+
);
28+
}

x-pack/solutions/observability/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_helpers/waterfall_helpers.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { euiPaletteColorBlind } from '@elastic/eui';
99
import type { Dictionary } from 'lodash';
1010
import { first, flatten, groupBy, isEmpty, sortBy, uniq } from 'lodash';
1111
import { ProcessorEvent } from '@kbn/observability-plugin/common';
12+
import { isOpenTelemetryAgentName } from '../../../../../../../../common/agent_name';
1213
import type { CriticalPathSegment } from '../../../../../../../../common/critical_path/types';
1314
import type { APIReturnType } from '../../../../../../../services/rest/create_call_apm_api';
1415
import type { Transaction } from '../../../../../../../../typings/es_schemas/ui/transaction';
@@ -75,6 +76,7 @@ interface IWaterfallItemBase<TDocument, TDoctype> {
7576
legendValues: Record<WaterfallLegendType, string>;
7677
spanLinksCount: SpanLinksCount;
7778
isOrphan?: boolean;
79+
missingDestination?: boolean;
7880
}
7981

8082
export type IWaterfallError = Omit<
@@ -594,6 +596,18 @@ function buildTree({
594596
hasInitializedChildren: false,
595597
};
596598

599+
// It is missing a destination when a child (currentNode) is a transaction
600+
// and its parent (node) is a span without destination for Otel agents.
601+
602+
if (
603+
currentNode.item.docType === 'transaction' &&
604+
node.item.docType === 'span' &&
605+
!node.item.doc.span?.destination?.service?.resource &&
606+
isOpenTelemetryAgentName(node.item.doc.agent.name)
607+
) {
608+
node.item.missingDestination = true;
609+
}
610+
597611
node.children.push(currentNode);
598612
queue.push(currentNode);
599613
});

x-pack/solutions/observability/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_item.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { FailureBadge } from './failure_badge';
2424
import { useApmRouter } from '../../../../../../hooks/use_apm_router';
2525
import { useAnyOfApmParams } from '../../../../../../hooks/use_apm_params';
2626
import { OrphanItemTooltipIcon } from './orphan_item_tooltip_icon';
27+
import { SpanMissingDestinationTooltip } from './span_missing_destination_tooltip';
2728

2829
type ItemType = 'transaction' | 'span' | 'error';
2930

@@ -286,6 +287,7 @@ export function WaterfallItem({
286287
<PrefixIcon item={item} />
287288
</SpanActionToolTip>
288289
{item.isOrphan ? <OrphanItemTooltipIcon docType={item.docType} /> : null}
290+
{item.missingDestination ? <SpanMissingDestinationTooltip /> : null}
289291
<HttpStatusCode item={item} />
290292
<NameLabel item={item} />
291293

x-pack/solutions/observability/plugins/apm/server/routes/traces/__snapshots__/queries.test.ts.snap

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/solutions/observability/plugins/apm/server/routes/traces/get_trace_items.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
SPAN_COMPOSITE_COMPRESSION_STRATEGY,
3838
SPAN_COMPOSITE_COUNT,
3939
SPAN_COMPOSITE_SUM,
40+
SPAN_DESTINATION_SERVICE_RESOURCE,
4041
SPAN_DURATION,
4142
SPAN_ID,
4243
SPAN_LINKS,
@@ -105,6 +106,7 @@ export async function getTraceItems({
105106
PARENT_ID,
106107
TRANSACTION_ID,
107108
SPAN_ID,
109+
SPAN_DESTINATION_SERVICE_RESOURCE,
108110
ERROR_CULPRIT,
109111
ERROR_LOG_MESSAGE,
110112
ERROR_EXC_MESSAGE,
@@ -303,6 +305,7 @@ async function getTraceDocsPerPage({
303305
SPAN_COMPOSITE_COMPRESSION_STRATEGY,
304306
SPAN_COMPOSITE_SUM,
305307
SPAN_SYNC,
308+
SPAN_DESTINATION_SERVICE_RESOURCE,
306309
CHILD_ID,
307310
OTEL_SPAN_LINKS_SPAN_ID,
308311
OTEL_SPAN_LINKS_TRACE_ID,

0 commit comments

Comments
 (0)