Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,12 @@ describe('LogsOverview with APM links', () => {
).not.toBeInTheDocument();
});

it('should render trace id link', () => {
expect(
screen.queryByTestId('unifiedDocViewLogsOverviewTraceIdHighlightLink')
).toBeInTheDocument();
it('should render trace id without a link', () => {
const traceId = screen.getByTestId('unifiedDocViewLogsOverviewTraceID');
expect(traceId).toBeInTheDocument();

const traceLink = traceId.querySelector('a');
expect(traceLink).toBeNull();
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { EuiBadge, EuiPanel } from '@elastic/eui';
import type { FieldConfiguration } from '../content_framework';
import { ContentFrameworkTable } from '../content_framework';
import { HighlightField } from '../observability/traces/components/highlight_field';
import { TraceIdLink } from '../observability/traces/components/trace_id_link';
import { fieldLabels } from '../observability/constants';

interface LogsOverviewHighlightsProps
Expand Down Expand Up @@ -93,15 +92,7 @@ const fieldConfigurations: Record<string, FieldConfiguration> = {
[fieldConstants.TRACE_ID_FIELD]: {
title: fieldLabels.TRACE_ID_LABEL,
formatter: (value: unknown, formattedValue: string) => (
<HighlightField value={value as string} formattedValue={formattedValue}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to keep the highlighting and only remove the link?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that's true, I'll quickly revert that, thanks 👍🏻

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Friendly reminder that it doesn't change the demo, because we're using ESQL there 🙇🏻

Screenshot 2026-01-20 at 15 05 42

{({ content }) => (
<TraceIdLink
traceId={value as string}
formattedTraceId={content}
data-test-subj="unifiedDocViewLogsOverviewTraceIdHighlightLink"
/>
)}
</HighlightField>
<HighlightField value={value as string} formattedValue={formattedValue} />
),
},
[fieldConstants.ORCHESTRATOR_CLUSTER_NAME_FIELD]: {
Expand Down Expand Up @@ -135,7 +126,6 @@ const fieldConfigurations: Record<string, FieldConfiguration> = {
},
[fieldConstants.DATASTREAM_NAMESPACE_FIELD]: {
title: fieldLabels.DATASTREAM_NAMESPACE_LABEL,

formatter: (value, formattedValue) => (
<HighlightField value={value as string} formattedValue={formattedValue}>
{({ content }) => <EuiBadge color="hollow">{content}</EuiBadge>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export const OPEN_IN_DISCOVER_LABEL = i18n.translate(
}
);

export const OPEN_IN_DISCOVER_LABEL_ARIAL_LABEL = i18n.translate(
'unifiedDocViewer.observability.traces.openInDiscoverArialLabel',
export const OPEN_IN_DISCOVER_ARIA_LABEL = i18n.translate(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing typo ARIAL -> ARIA

'unifiedDocViewer.observability.traces.openInDiscoverAriaLabel',
{ defaultMessage: 'Open in discover link' }
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { ServiceNameLink } from '../service_name_link';
import { TransactionNameLink } from '../transaction_name_link';
import { HighlightField } from '../highlight_field';
import { DependencyNameLink } from '../dependency_name_link';
import { TraceIdLink } from '../trace_id_link';
import { fieldDescriptions, fieldLabels } from '../../../constants';

export const getSharedFieldConfigurations = (
Expand Down Expand Up @@ -73,15 +72,7 @@ export const getSharedFieldConfigurations = (
[TRACE_ID]: {
title: fieldLabels.TRACE_ID_LABEL,
formatter: (value: unknown, formattedValue: string) => (
<HighlightField value={value as string} formattedValue={formattedValue}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

{({ content }) => (
<TraceIdLink
traceId={value as string}
formattedTraceId={content}
data-test-subj="unifiedDocViewerObservabilityTracesTraceIdLink"
/>
)}
</HighlightField>
<HighlightField value={value as string} formattedValue={formattedValue} />
),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { getColumns } from './get_columns';
import { useFetchErrorsByTraceId } from './use_fetch_errors_by_trace_id';
import { useDataSourcesContext } from '../../../../../hooks/use_data_sources';
import { useGetGenerateDiscoverLink } from '../../../../../hooks/use_generate_discover_link';
import { OPEN_IN_DISCOVER_LABEL, OPEN_IN_DISCOVER_LABEL_ARIAL_LABEL } from '../../common/constants';
import { OPEN_IN_DISCOVER_LABEL, OPEN_IN_DISCOVER_ARIA_LABEL } from '../../common/constants';
import { createTraceContextWhereClauseForErrors } from '../../common/create_trace_context_where_clause';
import {
ScrollableSectionWrapper,
Expand Down Expand Up @@ -89,7 +89,7 @@ export const ErrorsTable = forwardRef<ScrollableSectionWrapperApi, Props>(
{
icon: 'discoverApp',
label: OPEN_IN_DISCOVER_LABEL,
ariaLabel: OPEN_IN_DISCOVER_LABEL_ARIAL_LABEL,
ariaLabel: OPEN_IN_DISCOVER_ARIA_LABEL,
href: openInDiscoverLink,
dataTestSubj: 'unifiedDocViewerSpanLinksRefreshButton',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { useDataSourcesContext } from '../../../../../hooks/use_data_sources';
import { useGetGenerateDiscoverLink } from '../../../../../hooks/use_generate_discover_link';
import { getColumns } from './get_columns';
import { useFetchSpanLinks } from './use_fetch_span_links';
import { OPEN_IN_DISCOVER_LABEL, OPEN_IN_DISCOVER_LABEL_ARIAL_LABEL } from '../../common/constants';
import { OPEN_IN_DISCOVER_LABEL, OPEN_IN_DISCOVER_ARIA_LABEL } from '../../common/constants';

export interface Props {
traceId: string;
Expand Down Expand Up @@ -138,7 +138,7 @@ export function SpanLinks({ docId, traceId, processorEvent }: Props) {
{
icon: 'discoverApp',
label: OPEN_IN_DISCOVER_LABEL,
ariaLabel: OPEN_IN_DISCOVER_LABEL_ARIAL_LABEL,
ariaLabel: OPEN_IN_DISCOVER_ARIA_LABEL,
href: openInDiscoverLink,
dataTestSubj: 'unifiedDocViewerSpanLinksRefreshButton',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useDataSourcesContext } from '../../../../../hooks/use_data_sources';
import { useLogsQuery } from '../../hooks/use_logs_query';
import { useGetGenerateDiscoverLink } from '../../../../../hooks/use_generate_discover_link';
import { createTraceContextWhereClause } from '../../common/create_trace_context_where_clause';
import { OPEN_IN_DISCOVER_LABEL, OPEN_IN_DISCOVER_LABEL_ARIAL_LABEL } from '../../common/constants';
import { OPEN_IN_DISCOVER_LABEL, OPEN_IN_DISCOVER_ARIA_LABEL } from '../../common/constants';

const logsTitle = i18n.translate('unifiedDocViewer.observability.traces.section.logs.title', {
defaultMessage: 'Logs',
Expand Down Expand Up @@ -78,7 +78,7 @@ export function TraceContextLogEvents({
{
icon: 'discoverApp',
label: OPEN_IN_DISCOVER_LABEL,
ariaLabel: OPEN_IN_DISCOVER_LABEL_ARIAL_LABEL,
ariaLabel: OPEN_IN_DISCOVER_ARIA_LABEL,
href: openInDiscoverLink,
dataTestSubj: 'unifiedDocViewerLogsOpenInDiscoverButton',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
import { EuiDelayRender } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import type { DocViewRenderProps } from '@kbn/unified-doc-viewer/types';
import React, { useState } from 'react';
import React, { useMemo, useState } from 'react';
import { TRACE_ID_FIELD } from '@kbn/discover-utils';
import { useGetGenerateDiscoverLink } from '../../../../../hooks/use_generate_discover_link';
import { useDataSourcesContext } from '../../../../../hooks/use_data_sources';
import { ContentFrameworkSection } from '../../../../..';
import { getUnifiedDocViewerServices } from '../../../../../plugin';
import { FullScreenWaterfall } from '../full_screen_waterfall';
import { TraceWaterfallTourStep } from './full_screen_waterfall_tour_step';
import { OPEN_IN_DISCOVER_LABEL, OPEN_IN_DISCOVER_ARIA_LABEL } from '../../common/constants';

interface Props {
traceId: string;
Expand All @@ -38,17 +42,26 @@ const sectionTitle = i18n.translate('unifiedDocViewer.observability.traces.trace

export function TraceWaterfall({ traceId, docId, serviceName, dataView }: Props) {
const { data, discoverShared } = getUnifiedDocViewerServices();
const { indexes } = useDataSourcesContext();
const [showFullScreenWaterfall, setShowFullScreenWaterfall] = useState(false);
const { from: rangeFrom, to: rangeTo } = data.query.timefilter.timefilter.getAbsoluteTime();

const FocusedTraceWaterfall = discoverShared.features.registry.getById(
'observability-focused-trace-waterfall'
)?.render;
const [showFullScreenWaterfall, setShowFullScreenWaterfall] = useState(false);
const { from: rangeFrom, to: rangeTo } = data.query.timefilter.timefilter.getAbsoluteTime();

if (!FocusedTraceWaterfall) {
return null;
}
const { generateDiscoverLink } = useGetGenerateDiscoverLink({
indexPattern: indexes.apm.traces,
Comment thread
iblancof marked this conversation as resolved.
});

const openInDiscoverLink = useMemo(() => {
return generateDiscoverLink({ [TRACE_ID_FIELD]: traceId });
}, [generateDiscoverLink, traceId]);

const actionId = 'traceWaterfallFullScreenAction';

if (!FocusedTraceWaterfall) return null;

return (
<>
{showFullScreenWaterfall ? (
Expand Down Expand Up @@ -76,6 +89,17 @@ export function TraceWaterfall({ traceId, docId, serviceName, dataView }: Props)
id: actionId,
dataTestSubj: 'unifiedDocViewerObservabilityTracesTraceFullScreenButton',
},
...(openInDiscoverLink
? [
{
icon: 'discoverApp',
label: OPEN_IN_DISCOVER_LABEL,
ariaLabel: OPEN_IN_DISCOVER_ARIA_LABEL,
href: openInDiscoverLink,
dataTestSubj: 'unifiedDocViewerObservabilityTracesOpenInDiscoverButton',
},
]
: []),
]}
>
{docId ? (
Expand Down
Loading