Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: trace details UI fixes and improvements (#9576)

Shaheer Kochaia4f54baf1f7a
diff --git a/frontend/src/components/Logs/CopyClipboardHOC.tsx b/frontend/src/components/Logs/CopyClipboardHOC.tsx
index 0661a78ea1..323f52ee25 100644
--- a/frontend/src/components/Logs/CopyClipboardHOC.tsx
+++ b/frontend/src/components/Logs/CopyClipboardHOC.tsx
@@ -6,6 +6,7 @@ import { useCopyToClipboard } from 'react-use';
function CopyClipboardHOC({
entityKey,
textToCopy,
+ tooltipText = 'Copy to clipboard',
children,
}: CopyClipboardHOCProps): JSX.Element {
const [value, setCopy] = useCopyToClipboard();
@@ -31,7 +32,7 @@ function CopyClipboardHOC({
<span onClick={onClick} role="presentation" tabIndex={-1}>
<Popover
placement="top"
- content={<span style={{ fontSize: '0.9rem' }}>Copy to clipboard</span>}
+ content={<span style={{ fontSize: '0.9rem' }}>{tooltipText}</span>}
>
{children}
</Popover>
@@ -42,7 +43,11 @@ function CopyClipboardHOC({
interface CopyClipboardHOCProps {
entityKey: string | undefined;
textToCopy: string;
+ tooltipText?: string;
children: ReactNode;
}
export default CopyClipboardHOC;
+CopyClipboardHOC.defaultProps = {
+ tooltipText: 'Copy to clipboard',
+};
diff --git a/frontend/src/container/GantChart/Trace/index.tsx b/frontend/src/container/GantChart/Trace/index.tsx
index 8fbf6c905c..b9b67d81cb 100644
--- a/frontend/src/container/GantChart/Trace/index.tsx
+++ b/frontend/src/container/GantChart/Trace/index.tsx
@@ -1,9 +1,11 @@
import { CaretDownFilled, CaretRightFilled } from '@ant-design/icons';
import { Col, Typography } from 'antd';
import { StyledCol, StyledRow } from 'components/Styled';
-import { IIntervalUnit } from 'container/TraceDetail/utils';
+import {
+ IIntervalUnit,
+ SPAN_DETAILS_LEFT_COL_WIDTH,
+} from 'container/TraceDetail/utils';
import { useIsDarkMode } from 'hooks/useDarkMode';
-import { SPAN_DETAILS_LEFT_COL_WIDTH } from 'pages/TraceDetail/constants';
import {
Dispatch,
MouseEventHandler,
diff --git a/frontend/src/container/PaginatedTraceFlamegraph/PaginatedTraceFlamegraph.tsx b/frontend/src/container/PaginatedTraceFlamegraph/PaginatedTraceFlamegraph.tsx
index c01fc274d4..09963f18f5 100644
--- a/frontend/src/container/PaginatedTraceFlamegraph/PaginatedTraceFlamegraph.tsx
+++ b/frontend/src/container/PaginatedTraceFlamegraph/PaginatedTraceFlamegraph.tsx
@@ -5,7 +5,6 @@ import { AxiosError } from 'axios';
import Spinner from 'components/Spinner';
import { themeColors } from 'constants/theme';
import useGetTraceFlamegraph from 'hooks/trace/useGetTraceFlamegraph';
-import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
import { useEffect, useMemo, useState } from 'react';
@@ -48,7 +47,6 @@ function TraceFlamegraph(props: ITraceFlamegraphProps): JSX.Element {
traceId,
selectedSpanId: firstSpanAtFetchLevel,
});
- const isDarkMode = useIsDarkMode();
// get the current state of trace flamegraph based on the API lifecycle
const traceFlamegraphState = useMemo(() => {
@@ -124,6 +122,8 @@ function TraceFlamegraph(props: ITraceFlamegraphProps): JSX.Element {
traceId,
]);
+ const spread = useMemo(() => endTime - startTime, [endTime, startTime]);
+
return (
<div className="flamegraph">
<div
@@ -132,36 +132,40 @@ function TraceFlamegraph(props: ITraceFlamegraphProps): JSX.Element {
>
<div className="exec-time-service">% exec time</div>
<div className="stats">
- {Object.keys(serviceExecTime).map((service) => {
- const spread = endTime - startTime;
- const value = (serviceExecTime[service] * 100) / spread;
- const color = generateColor(
- service,
- isDarkMode ? themeColors.chartcolors : themeColors.lightModeColor,
- );
- return (
- <div key={service} className="value-row">
- <section className="service-name">
- <div className="square-box" style={{ backgroundColor: color }} />
- <Tooltip title={service}>
- <Typography.Text className="service-text" ellipsis>
- {service}
+ {Object.keys(serviceExecTime)
+ .sort((a, b) => {
+ if (spread <= 0) return 0;
+ const aValue = (serviceExecTime[a] * 100) / spread;
+ const bValue = (serviceExecTime[b] * 100) / spread;
+ return bValue - aValue;
+ })
+ .map((service) => {
+ const value =
+ spread <= 0 ? 0 : (serviceExecTime[service] * 100) / spread;
+ const color = generateColor(service, themeColors.traceDetailColors);
+ return (
+ <div key={service} className="value-row">
+ <section className="service-name">
+ <div className="square-box" style={{ backgroundColor: color }} />
+ <Tooltip title={service}>
+ <Typography.Text className="service-text" ellipsis>
+ {service}
+ </Typography.Text>
+ </Tooltip>
+ </section>
+ <section className="progress-service">
+ <Progress
+ percent={parseFloat(value.toFixed(2))}
+ className="service-progress-indicator"
+ showInfo={false}
+ />
+ <Typography.Text className="percent-value">
+ {parseFloat(value.toFixed(2))}%
</Typography.Text>
- </Tooltip>
- </section>
- <section className="progress-service">
- <Progress
- percent={parseFloat(value.toFixed(2))}
- className="service-progress-indicator"
- showInfo={false}
- />
- <Typography.Text className="percent-value">
- {parseFloat(value.toFixed(2))}%
- </Typography.Text>
- </section>
- </div>
- );
- })}
+ </section>
+ </div>
+ );
+ })}
</div>
</div>
<div
diff --git a/frontend/src/container/SpanDetailsDrawer/Attributes/AttributeActions.tsx b/frontend/src/container/SpanDetailsDrawer/Attributes/AttributeActions.tsx
index f382bd8115..1df6367189 100644
--- a/frontend/src/container/SpanDetailsDrawer/Attributes/AttributeActions.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/Attributes/AttributeActions.tsx
@@ -1,5 +1,6 @@
import { Button, Popover, Spin, Tooltip } from 'antd';
import GroupByIcon from 'assets/CustomIcons/GroupByIcon';
+import cx from 'classnames';
import { OPERATORS } from 'constants/antlrQueryConstants';
import { useTraceActions } from 'hooks/trace/useTraceActions';
import {
@@ -124,7 +125,7 @@ export default function AttributeActions({
);
return (
- <div className="action-btn">
+ <div className={cx('action-btn', { 'action-btn--is-open': isOpen })}>
<Tooltip title={isPinned ? 'Unpin attribute' : 'Pin attribute'}>
<Button
className={`filter-btn periscope-btn ${isPinned ? 'pinned' : ''}`}
diff --git a/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.styles.scss b/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.styles.scss
index 880125d84d..c50804ea81 100644
--- a/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.styles.scss
+++ b/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.styles.scss
@@ -17,7 +17,7 @@
display: flex;
flex-direction: column;
gap: 12px;
- padding: 12px;
+ padding-block: 12px;
.item {
display: flex;
@@ -25,8 +25,10 @@
gap: 8px;
justify-content: flex-start;
position: relative;
+ padding: 2px 12px;
&:hover {
+ background-color: var(--bg-slate-500);
.action-btn {
display: flex;
}
@@ -81,12 +83,15 @@
.action-btn {
display: none;
+
+ &--is-open {
+ display: flex;
+ }
position: absolute;
right: 8px;
top: 50%;
transform: translateY(-50%);
gap: 4px;
- background: rgba(0, 0, 0, 0.8);
border-radius: 4px;
padding: 2px;
@@ -149,6 +154,9 @@
.attributes-corner {
.attributes-container {
.item {
+ &:hover {
+ background-color: var(--bg-vanilla-300);
+ }
.item-key {
color: var(--bg-ink-100);
}
@@ -163,8 +171,6 @@
}
.action-btn {
- background: rgba(255, 255, 255, 0.9);
-
.filter-btn {
background: var(--bg-vanilla-200);
diff --git a/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.tsx b/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.tsx
index 069f61e0b5..5003a03853 100644
--- a/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/Attributes/Attributes.tsx
@@ -1,6 +1,6 @@
import './Attributes.styles.scss';
-import { Input, Tooltip, Typography } from 'antd';
+import { Input, Typography } from 'antd';
import cx from 'classnames';
import CopyClipboardHOC from 'components/Logs/CopyClipboardHOC';
import { flattenObject } from 'container/LogDetailedView/utils';
@@ -83,37 +83,41 @@ function Attributes(props: IAttributesProps): JSX.Element {
<section
className={cx('attributes-container', isSearchVisible ? 'border-top' : '')}
>
- {datasource.map((item) => (
- <div
- className={cx('item', { pinned: pinnedAttributes[item.field] })}
- key={`${item.field} + ${item.value}`}
- >
- <div className="item-key-wrapper">
- <Typography.Text className="item-key" ellipsis>
- {item.field}
- </Typography.Text>
- {pinnedAttributes[item.field] && (
- <Pin size={14} className="pin-icon" fill="currentColor" />
- )}
- </div>
- <div className="value-wrapper">
- <Tooltip title={item.value}>
+ {datasource
+ .filter((item) => !!item.value && item.value !== '-')
+ .map((item) => (
+ <div
+ className={cx('item', { pinned: pinnedAttributes[item.field] })}
+ key={`${item.field} + ${item.value}`}
+ >
+ <div className="item-key-wrapper">
+ <Typography.Text className="item-key" ellipsis>
+ {item.field}
+ </Typography.Text>
+ {pinnedAttributes[item.field] && (
+ <Pin size={14} className="pin-icon" fill="currentColor" />
+ )}
+ </div>
+ <div className="value-wrapper">
<div className="copy-wrapper">
- <CopyClipboardHOC entityKey={item.value} textToCopy={item.value}>
+ <CopyClipboardHOC
+ entityKey={item.value}
+ textToCopy={item.value}
+ tooltipText={item.value}
+ >
<Typography.Text className="item-value" ellipsis>
{item.value}
</Typography.Text>
</CopyClipboardHOC>
</div>
- </Tooltip>
- <AttributeActions
- record={item}
- isPinned={pinnedAttributes[item.field]}
- onTogglePin={togglePin}
- />
+ <AttributeActions
+ record={item}
+ isPinned={pinnedAttributes[item.field]}
+ onTogglePin={togglePin}
+ />
+ </div>
</div>
- </div>
- ))}
+ ))}
</section>
</div>
);
diff --git a/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.styles.scss b/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.styles.scss
index 4cd534631d..682cebc667 100644
--- a/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.styles.scss
+++ b/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.styles.scss
@@ -471,6 +471,22 @@
}
}
}
+
+ .related-signals-section {
+ .view-title {
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ font-size: 12px;
+ line-height: 30px;
+ }
+ .ant-btn.ant-btn-default {
+ padding: 0 15px;
+ &:not(:hover) {
+ border: 1px solid var(--bg-slate-400);
+ }
+ }
+ }
}
}
@@ -605,6 +621,12 @@
}
.lightMode {
+ .ant-tabs-content-holder {
+ .bg-border {
+ background: var(--bg-vanilla-300);
+ border-color: var(--bg-vanilla-300);
+ }
+ }
.span-details-drawer {
border-left: 1px solid var(--bg-vanilla-300);
@@ -813,6 +835,16 @@
}
}
}
+
+ .related-signals-section {
+ .related-signals-button-group {
+ .ant-btn.ant-btn-default {
+ &:not(:hover) {
+ border: 1px solid var(--bg-vanilla-400);
+ }
+ }
+ }
+ }
}
}
diff --git a/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.tsx b/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.tsx
index d73e207825..efa51cfb2a 100644
--- a/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.tsx
@@ -11,13 +11,11 @@ import {
Tooltip,
Typography,
} from 'antd';
-import { RadioChangeEvent } from 'antd/lib';
import getSpanPercentiles from 'api/trace/getSpanPercentiles';
import getUserPreference from 'api/v1/user/preferences/name/get';
import updateUserPreference from 'api/v1/user/preferences/name/update';
import LogsIcon from 'assets/AlertHistory/LogsIcon';
import { getYAxisFormattedValue } from 'components/Graph/yAxisConfig';
-import SignozRadioGroup from 'components/SignozRadioGroup/SignozRadioGroup';
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { themeColors } from 'constants/theme';
@@ -178,11 +176,13 @@ function SpanDetailsDrawer(props: ISpanDetailsDrawerProps): JSX.Element {
themeColors.traceDetailColors,
);
- const handleRelatedSignalsChange = useCallback((e: RadioChangeEvent): void => {
- const selectedView = e.target.value as RelatedSignalsViews;
- setActiveDrawerView(selectedView);
- setIsRelatedSignalsOpen(true);
- }, []);
+ const handleRelatedSignalsClick = useCallback(
+ (view: RelatedSignalsViews): void => {
+ setActiveDrawerView(view);
+ setIsRelatedSignalsOpen(true);
+ },
+ [],
+ );
const handleRelatedSignalsClose = useCallback((): void => {
setIsRelatedSignalsOpen(false);
@@ -883,12 +883,16 @@ function SpanDetailsDrawer(props: ISpanDetailsDrawerProps): JSX.Element {
related signals
</Typography.Text>
<div className="related-signals-section">
- <SignozRadioGroup
- value=""
- options={relatedSignalsOptions}
- onChange={handleRelatedSignalsChange}
- className="related-signals-radio"
- />
+ <Button.Group className="related-signals-button-group">
+ {relatedSignalsOptions.map((option) => (
+ <Button
+ key={option.value}
+ onClick={(): void => handleRelatedSignalsClick(option.value)}
+ >
+ {option.label}
+ </Button>
+ ))}
+ </Button.Group>
</div>
</div>
</section>
diff --git a/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.infraMetrics.test.tsx b/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.infraMetrics.test.tsx
index f4119d4ad6..bf5dcea582 100644
--- a/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.infraMetrics.test.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.infraMetrics.test.tsx
@@ -253,7 +253,7 @@ describe('SpanDetailsDrawer - Infra Metrics', () => {
renderSpanDetailsDrawer();
// Click on metrics tab
- const infraMetricsButton = screen.getByRole('radio', { name: /metrics/i });
+ const infraMetricsButton = screen.getByRole('button', { name: /metrics/i });
expect(infraMetricsButton).toBeInTheDocument();
fireEvent.click(infraMetricsButton);
@@ -301,17 +301,17 @@ describe('SpanDetailsDrawer - Infra Metrics', () => {
// Should NOT show infra tab, only logs tab
expect(
- screen.queryByRole('radio', { name: /metrics/i }),
+ screen.queryByRole('button', { name: /metrics/i }),
).not.toBeInTheDocument();
- expect(screen.getByRole('radio', { name: /logs/i })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /logs/i })).toBeInTheDocument();
});
it('should show infra tab when span has infra metadata', async () => {
renderSpanDetailsDrawer();
// Should show both logs and infra tabs
- expect(screen.getByRole('radio', { name: /metrics/i })).toBeInTheDocument();
- expect(screen.getByRole('radio', { name: /logs/i })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /metrics/i })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /logs/i })).toBeInTheDocument();
});
it('should handle pod-only metadata correctly', async () => {
@@ -328,7 +328,7 @@ describe('SpanDetailsDrawer - Infra Metrics', () => {
);
// Click on infra tab
- const infraMetricsButton = screen.getByRole('radio', { name: /metrics/i });
+ const infraMetricsButton = screen.getByRole('button', { name: /metrics/i });
fireEvent.click(infraMetricsButton);
await waitFor(() => {
@@ -364,7 +364,7 @@ describe('SpanDetailsDrawer - Infra Metrics', () => {
);
// Click on infra tab
- const infraMetricsButton = screen.getByRole('radio', { name: /metrics/i });
+ const infraMetricsButton = screen.getByRole('button', { name: /metrics/i });
fireEvent.click(infraMetricsButton);
await waitFor(() => {
@@ -400,7 +400,7 @@ describe('SpanDetailsDrawer - Infra Metrics', () => {
);
// Click on infra tab
- const infraMetricsButton = screen.getByRole('radio', { name: /metrics/i });
+ const infraMetricsButton = screen.getByRole('button', { name: /metrics/i });
fireEvent.click(infraMetricsButton);
await waitFor(() => {
@@ -426,8 +426,8 @@ describe('SpanDetailsDrawer - Infra Metrics', () => {
renderSpanDetailsDrawer();
// Initially should show logs tab content
- const logsButton = screen.getByRole('radio', { name: /logs/i });
- const infraMetricsButton = screen.getByRole('radio', { name: /metrics/i });
+ const logsButton = screen.getByRole('button', { name: /logs/i });
+ const infraMetricsButton = screen.getByRole('button', { name: /metrics/i });
expect(logsButton).toBeInTheDocument();
expect(infraMetricsButton).toBeInTheDocument();
@@ -470,10 +470,10 @@ describe('SpanDetailsDrawer - Infra Metrics', () => {
renderSpanDetailsDrawer();
// Should show infra tab when span has any of: clusterName, podName, nodeName, hostName
- expect(screen.getByRole('radio', { name: /metrics/i })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /metrics/i })).toBeInTheDocument();
// Click on infra tab
- const infraMetricsButton = screen.getByRole('radio', { name: /metrics/i });
+ const infraMetricsButton = screen.getByRole('button', { name: /metrics/i });
fireEvent.click(infraMetricsButton);
await waitFor(() => {
diff --git a/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx b/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx
index 4b0ad009e9..9b2b8e4e4f 100644
--- a/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/__tests__/SpanDetailsDrawer.test.tsx
@@ -363,7 +363,7 @@ describe('SpanDetailsDrawer', () => {
renderSpanDetailsDrawer();
// Verify logs tab is visible
- const logsButton = screen.getByRole('radio', { name: /logs/i });
+ const logsButton = screen.getByRole('button', { name: /logs/i });
expect(logsButton).toBeInTheDocument();
expect(logsButton).toBeVisible();
});
@@ -372,7 +372,7 @@ describe('SpanDetailsDrawer', () => {
renderSpanDetailsDrawer();
// Click on logs tab
- const logsButton = screen.getByRole('radio', { name: /logs/i });
+ const logsButton = screen.getByRole('button', { name: /logs/i });
fireEvent.click(logsButton);
// Wait for logs view to open and logs to be displayed
@@ -393,7 +393,7 @@ describe('SpanDetailsDrawer', () => {
renderSpanDetailsDrawer();
// Click on logs tab to trigger API calls
- const logsButton = screen.getByRole('radio', { name: /logs/i });
+ const logsButton = screen.getByRole('button', { name: /logs/i });
fireEvent.click(logsButton);
// Wait for all API calls to complete
@@ -434,7 +434,7 @@ describe('SpanDetailsDrawer', () => {
renderSpanDetailsDrawer();
// Click on logs tab to trigger API calls
- const logsButton = screen.getByRole('radio', { name: /logs/i });
+ const logsButton = screen.getByRole('button', { name: /logs/i });
fireEvent.click(logsButton);
// Wait for all API calls to complete
@@ -468,7 +468,7 @@ describe('SpanDetailsDrawer', () => {
renderSpanDetailsDrawer();
// Open logs view
- const logsButton = screen.getByRole('radio', { name: /logs/i });
+ const logsButton = screen.getByRole('button', { name: /logs/i });
fireEvent.click(logsButton);
// Wait for logs to load
@@ -514,7 +514,7 @@ describe('SpanDetailsDrawer', () => {
renderSpanDetailsDrawer();
// Open logs view
- const logsButton = screen.getByRole('radio', { name: /logs/i });
+ const logsButton = screen.getByRole('button', { name: /logs/i });
fireEvent.click(logsButton);
// Wait for logs to load
@@ -560,7 +560,7 @@ describe('SpanDetailsDrawer', () => {
renderSpanDetailsDrawer();
// Open logs view
- const logsButton = screen.getByRole('radio', { name: /logs/i });
+ const logsButton = screen.getByRole('button', { name: /logs/i });
fireEvent.click(logsButton);
// Wait for logs to load
@@ -589,7 +589,7 @@ describe('SpanDetailsDrawer', () => {
renderSpanDetailsDrawer();
// Open logs view
- const logsButton = screen.getByRole('radio', { name: /logs/i });
+ const logsButton = screen.getByRole('button', { name: /logs/i });
fireEvent.click(logsButton);
// Wait for all API calls to complete first
diff --git a/frontend/src/container/TraceDetail/index.tsx b/frontend/src/container/TraceDetail/index.tsx
index f4b80b78c7..2666bd556d 100644
--- a/frontend/src/container/TraceDetail/index.tsx
+++ b/frontend/src/container/TraceDetail/index.tsx
@@ -24,7 +24,6 @@ import { spanServiceNameToColorMapping } from 'lib/getRandomColor';
import history from 'lib/history';
import { map } from 'lodash-es';
import { PanelRight } from 'lucide-react';
-import { SPAN_DETAILS_LEFT_COL_WIDTH } from 'pages/TraceDetail/constants';
import { useTimezone } from 'providers/Timezone';
import { useEffect, useMemo, useState } from 'react';
import { ITraceForest, PayloadProps } from 'types/api/trace/getTraceItem';
@@ -42,6 +41,7 @@ import {
getTreeLevelsCount,
IIntervalUnit,
INTERVAL_UNITS,
+ SPAN_DETAILS_LEFT_COL_WIDTH,
} from './utils';
const { Sider } = Layout;
diff --git a/frontend/src/container/TraceDetail/utils.ts b/frontend/src/container/TraceDetail/utils.ts
index c907a1e586..25068a4ef3 100644
--- a/frontend/src/container/TraceDetail/utils.ts
+++ b/frontend/src/container/TraceDetail/utils.ts
@@ -13,6 +13,8 @@ export const filterSpansByString = (
return JSON.stringify(spanWithoutChildren).includes(searchString);
});
+export const SPAN_DETAILS_LEFT_COL_WIDTH = 350;
+
type TTimeUnitName = 'ms' | 's' | 'm' | 'hr' | 'day' | 'week';
export interface IIntervalUnit {
diff --git a/frontend/src/pages/TraceDetail/TraceDetail.styles.scss b/frontend/src/pages/TraceDetail/TraceDetail.styles.scss
deleted file mode 100644
index bf1696ebe4..0000000000
--- a/frontend/src/pages/TraceDetail/TraceDetail.styles.scss
+++ /dev/null
@@ -1,45 +0,0 @@
-.old-trace-container {
- display: flex;
- flex-direction: column;
- height: 100%;
-
- .top-header {
- display: flex;
- flex-direction: row-reverse;
- padding: 5px;
- border-bottom: 1px solid var(--bg-slate-400);
-
- .new-cta-btn {
- display: flex;
- padding: 4px 6px;
- align-items: center;
- gap: 8px;
- color: var(--Vanilla-400, #c0c1c3);
-
- /* Bifrost (Ancient)/Content/sm */
- font-family: Inter;
- font-size: 14px;
- font-style: normal;
- font-weight: 400;
- line-height: 20px; /* 142.857% */
- letter-spacing: -0.07px;
- box-shadow: none;
-
- .ant-btn-icon {
- margin-inline-end: 0px;
- }
- }
- }
-}
-
-.lightMode {
- .old-trace-container {
- .top-header {
- border-bottom: 1px solid var(--bg-vanilla-300);
-
- .new-cta-btn {
- color: var(--bg-ink-400);
- }
- }
- }
-}
diff --git a/frontend/src/pages/TraceDetail/__test__/TraceDetail.test.tsx b/frontend/src/pages/TraceDetail/__test__/TraceDetail.test.tsx
deleted file mode 100644
index 5db650a700..0000000000
--- a/frontend/src/pages/TraceDetail/__test__/TraceDetail.test.tsx
+++ /dev/null
@@ -1,231 +0,0 @@
-/* eslint-disable sonarjs/no-duplicate-string */
-/* eslint-disable @typescript-eslint/explicit-function-return-type */
-import ROUTES from 'constants/routes';
-import { MemoryRouter, Route } from 'react-router-dom';
-import { fireEvent, render, screen } from 'tests/test-utils';
-
-import TraceDetail from '..';
-
-window.HTMLElement.prototype.scrollIntoView = jest.fn();
-
-jest.mock('@signozhq/badge', () => ({
- Badge: jest.fn(),
-}));
-
-jest.mock('@signozhq/resizable', () => ({
- ResizableHandle: jest.fn(),
- ResizablePanel: jest.fn(),
- ResizablePanelGroup: jest.fn(),
-}));
-
-jest.mock('react-router-dom', () => ({
- ...jest.requireActual('react-router-dom'),
- useLocation: (): { pathname: string; search: string } => ({
- pathname: `${process.env.FRONTEND_API_ENDPOINT}${ROUTES.TRACE_DETAIL}`,
- search: '?spanId=28a8a67365d0bd8b&levelUp=0&levelDown=0',
- }),
-
- useParams: jest.fn().mockReturnValue({
- id: '000000000000000071dc9b0a338729b4',
- }),
-}));
-
-jest.mock('container/TraceFlameGraph/index.tsx', () => ({
- __esModule: true,
- default: (): JSX.Element => <div>TraceFlameGraph</div>,
-}));
-
-describe('TraceDetail', () => {
- beforeEach(() => {
- jest.useFakeTimers();
- jest.setSystemTime(new Date('2023-10-20'));
- });
-
- afterEach(() => {
- jest.useRealTimers();
- });
-
- it('should render tracedetail', async () => {
- const { findByText, getByText, getAllByText, getByPlaceholderText } = render(
- <MemoryRouter initialEntries={['/trace/000000000000000071dc9b0a338729b4']}>
- <Route path={ROUTES.TRACE_DETAIL}>
- <TraceDetail />
- </Route>
- ,
- </MemoryRouter>,
- );
- expect(await findByText('Trace Details')).toBeInTheDocument();
-
- // as we have an active spanId, it should scroll to the selected span
- expect(window.HTMLElement.prototype.scrollIntoView).toHaveBeenCalled();
-
- // assertions
- expect(getByText('TraceFlameGraph')).toBeInTheDocument();
- expect(getByText('Focus on selected span')).toBeInTheDocument();
-
- // span action buttons
- expect(getByText('Reset Focus')).toBeInTheDocument();
- expect(getByText('50 Spans')).toBeInTheDocument();
-
- // trace span detail - parent -> child
- expect(getAllByText('frontend')[0]).toBeInTheDocument();
- expect(getByText('776.76 ms')).toBeInTheDocument();
- [
- { trace: 'HTTP GET /dispatch', duration: '776.76 ms', count: '50' },
- { trace: 'HTTP GET: /customer', duration: '349.44 ms', count: '4' },
- {
- trace: '/driver.DriverService/FindNearest',
- duration: '173.10 ms',
- count: '15',
- },
- // and so on ...
- ].forEach((traceDetail) => {
- expect(getByText(traceDetail.trace)).toBeInTheDocument();
- expect(getByText(traceDetail.duration)).toBeInTheDocument();
- expect(getByText(traceDetail.count)).toBeInTheDocument();
- });
-
- // Details for selected Span
- expect(getByText('Details for selected Span')).toBeInTheDocument();
- ['Service', 'Operation', 'SpanKind', 'StatusCodeString'].forEach((detail) => {
- expect(getByText(detail)).toBeInTheDocument();
- });
-
- // go to related logs button
- const goToRelatedLogsButton = getByText('Go to Related logs');
- expect(goToRelatedLogsButton).toBeInTheDocument();
-
- // Tag and Event tabs
- expect(getByText('Tags')).toBeInTheDocument();
- expect(getByText('Events')).toBeInTheDocument();
- expect(getByPlaceholderText('traceDetails:search_tags')).toBeInTheDocument();
-
- // Tag details
- [
- { title: 'client-uuid', value: '64a18ffd5f8adbfb' },
- { title: 'component', value: 'net/http' },
- { title: 'host.name', value: '4f6ec470feea' },
- { title: 'http.method', value: 'GET' },
- { title: 'http.url', value: '/route?dropoff=728%2C326&pickup=165%2C543' },
- { title: 'http.status_code', value: '200' },
- { title: 'ip', value: '172.25.0.2' },
- { title: 'opencensus.exporterversion', value: 'Jaeger-Go-2.30.0' },
- ].forEach((tag) => {
- expect(getByText(tag.title)).toBeInTheDocument();
- expect(getByText(tag.value)).toBeInTheDocument();
- });
-
- // see full value
- expect(getAllByText('View full value')[0]).toBeInTheDocument();
- });
-
- it('should render tracedetail events tab', async () => {
- const { findByText, getByText } = render(
- <MemoryRouter initialEntries={['/trace/000000000000000071dc9b0a338729b4']}>
- <Route path={ROUTES.TRACE_DETAIL}>
- <TraceDetail />
- </Route>
- ,
- </MemoryRouter>,
- );
- expect(await findByText('Trace Details')).toBeInTheDocument();
-
- fireEvent.click(getByText('Events'));
-
- expect(await screen.findByText('HTTP request received')).toBeInTheDocument();
-
- // event details
- [
- { title: 'Event Start Time', value: '527.60 ms' },
- { title: 'level', value: 'info' },
- ].forEach((tag) => {
- expect(getByText(tag.title)).toBeInTheDocument();
- expect(getByText(tag.value)).toBeInTheDocument();
- });
-
- expect(getByText('View full log event message')).toBeInTheDocument();
- });
-
- it('should toggle slider - selected span details', async () => {
- const { findByTestId, queryByText } = render(
- <MemoryRouter initialEntries={['/trace/000000000000000071dc9b0a338729b4']}>
- <Route path={ROUTES.TRACE_DETAIL}>
- <TraceDetail />
- </Route>
- ,
- </MemoryRouter>,
- );
- const slider = await findByTestId('span-details-sider');
- expect(slider).toBeInTheDocument();
-
- fireEvent.click(slider.querySelector('.expand-collapse-btn') as HTMLElement);
-
- expect(queryByText('Details for selected Span')).not.toBeInTheDocument();
- });
-
- it('should be able to selected another span and see its detail', async () => {
- const { getByText } = render(
- <MemoryRouter initialEntries={['/trace/000000000000000071dc9b0a338729b4']}>
- <Route path={ROUTES.TRACE_DETAIL}>
- <TraceDetail />
- </Route>
- ,
- </MemoryRouter>,
- );
-
- expect(await screen.findByText('Trace Details')).toBeInTheDocument();
-
- const spanTitle = getByText('/driver.DriverService/FindNearest');
- expect(spanTitle).toBeInTheDocument();
- fireEvent.click(spanTitle);
-
- // Tag details
- [
- { title: 'client-uuid', value: '6fb81b8ca91b2b4d' },
- { title: 'component', value: 'gRPC' },
- { title: 'host.name', value: '4f6ec470feea' },
- ].forEach((tag) => {
- expect(getByText(tag.title)).toBeInTheDocument();
- expect(getByText(tag.value)).toBeInTheDocument();
- });
- });
-
- it('focus on selected span and reset focus action', async () => {
- const { getByText, getAllByText } = render(
- <MemoryRouter initialEntries={['/trace/000000000000000071dc9b0a338729b4']}>
- <Route path={ROUTES.TRACE_DETAIL}>
- <TraceDetail />
- </Route>
- ,
- </MemoryRouter>,
- );
-
- expect(await screen.findByText('Trace Details')).toBeInTheDocument();
-
- const spanTitle = getByText('/driver.DriverService/FindNearest');
- expect(spanTitle).toBeInTheDocument();
- fireEvent.click(spanTitle);
-
- expect(await screen.findByText('6fb81b8ca91b2b4d')).toBeInTheDocument();
-
- // focus on selected span
- const focusButton = getByText('Focus on selected span');
- expect(focusButton).toBeInTheDocument();
- fireEvent.click(focusButton);
-
- // assert selected span
- expect(getByText('15 Spans')).toBeInTheDocument();
- expect(getAllByText('/driver.DriverService/FindNearest')).toHaveLength(3);
- expect(getByText('173.10 ms')).toBeInTheDocument();
-
- // reset focus
- expect(screen.queryByText('HTTP GET /dispatch')).not.toBeInTheDocument();
-
- const resetFocusButton = getByText('Reset Focus');
- expect(resetFocusButton).toBeInTheDocument();
- fireEvent.click(resetFocusButton);
-
- expect(window.HTMLElement.prototype.scrollIntoView).toHaveBeenCalled();
- expect(screen.queryByText('HTTP GET /dispatch')).toBeInTheDocument();
- });
-});
diff --git a/frontend/src/pages/TraceDetail/constants.ts b/frontend/src/pages/TraceDetail/constants.ts
deleted file mode 100644
index 42fb237070..0000000000
--- a/frontend/src/pages/TraceDetail/constants.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export const SPAN_DETAILS_LEFT_COL_WIDTH = 350;
-
-export const noEventMessage =
- 'The requested trace id was not found. Sometimes this happens because of insertion delay in trace data. Please try again after some time';
diff --git a/frontend/src/pages/TraceDetail/index.tsx b/frontend/src/pages/TraceDetail/index.tsx
deleted file mode 100644
index 3ab4856267..0000000000
--- a/frontend/src/pages/TraceDetail/index.tsx
+++ /dev/null
@@ -1,76 +0,0 @@
-import './TraceDetail.styles.scss';
-
-import { Button, Typography } from 'antd';
-import getTraceItem from 'api/trace/getTraceItem';
-import NotFound from 'components/NotFound';
-import Spinner from 'components/Spinner';
-import TraceDetailContainer from 'container/TraceDetail';
-import useUrlQuery from 'hooks/useUrlQuery';
-import { Undo } from 'lucide-react';
-import TraceDetailsPage from 'pages/TraceDetailV2';
-import { useMemo, useState } from 'react';
-import { useQuery } from 'react-query';
-import { useParams } from 'react-router-dom';
-import { Props as TraceDetailProps } from 'types/api/trace/getTraceItem';
-
-import { noEventMessage } from './constants';
-
-function TraceDetail(): JSX.Element {
- const { id } = useParams<TraceDetailProps>();
- const [showNewTraceDetails, setShowNewTraceDetails] = useState<boolean>(false);
- const urlQuery = useUrlQuery();
- const { spanId, levelUp, levelDown } = useMemo(
- () => ({
- spanId: urlQuery.get('spanId'),
- levelUp: urlQuery.get('levelUp'),
- levelDown: urlQuery.get('levelDown'),
- }),
- [urlQuery],
- );
-
- const { data: traceDetailResponse, error, isLoading, isError } = useQuery(
- `getTraceItem/${id}`,
- () => getTraceItem({ id, spanId, levelUp, levelDown }),
- {
- cacheTime: 3000,
- },
- );
-
- if (showNewTraceDetails) {
- return <TraceDetailsPage />;
- }
-
- if (traceDetailResponse?.error || error || isError) {
- return (
- <Typography>
- {traceDetailResponse?.error || 'Something went wrong'}
- </Typography>
- );
- }
-
- if (isLoading || !(traceDetailResponse && traceDetailResponse.payload)) {
- return <Spinner tip="Loading.." />;
- }
-
- if (traceDetailResponse.payload[0].events.length === 0) {
- return <NotFound text={noEventMessage} />;
- }
-
- return (
- <div className="old-trace-container">
- <div className="top-header">
- <Button
- onClick={(): void => setShowNewTraceDetails(true)}
- icon={<Undo size={14} />}
- type="text"
- className="new-cta-btn"
- >
- New Trace Detail
- </Button>
- </div>
- <TraceDetailContainer response={traceDetailResponse.payload} />;
- </div>
- );
-}
-
-export default TraceDetail;
diff --git a/frontend/src/pages/TraceDetailV2/index.tsx b/frontend/src/pages/TraceDetailV2/index.tsx
index a6c85468a4..012f9a6dd4 100644
--- a/frontend/src/pages/TraceDetailV2/index.tsx
+++ b/frontend/src/pages/TraceDetailV2/index.tsx
@@ -1,12 +1,10 @@
import './TraceDetailV2.styles.scss';
-import { Button, Tabs } from 'antd';
+import { Tabs } from 'antd';
import logEvent from 'api/common/logEvent';
import ROUTES from 'constants/routes';
import history from 'lib/history';
-import { Compass, Cone, TowerControl, Undo } from 'lucide-react';
-import TraceDetail from 'pages/TraceDetail';
-import { useCallback, useState } from 'react';
+import { Compass, Cone, TowerControl } from 'lucide-react';
import TraceDetailsV2 from './TraceDetailV2';
@@ -16,11 +14,10 @@ interface INewTraceDetailProps {
key: string;
children: JSX.Element;
}[];
- handleOldTraceDetails: () => void;
}
function NewTraceDetail(props: INewTraceDetailProps): JSX.Element {
- const { items, handleOldTraceDetails } = props;
+ const { items } = props;
return (
<div className="traces-module-container">
<Tabs
@@ -39,24 +36,12 @@ function NewTraceDetail(props: INewTraceDetailProps): JSX.Element {
history.push(ROUTES.TRACES_FUNNELS);
}
}}
- tabBarExtraContent={
- <Button
- type="text"
- onClick={handleOldTraceDetails}
- className="old-switch"
- icon={<Undo size={14} />}
- >
- Old Trace Details
- </Button>
- }
/>
</div>
);
}
export default function TraceDetailsPage(): JSX.Element {
- const [showOldTraceDetails, setShowOldTraceDetails] = useState<boolean>(false);
-
const items = [
{
label: (
@@ -86,13 +71,6 @@ export default function TraceDetailsPage(): JSX.Element {
children: <div />,
},
];
- const handleOldTraceDetails = useCallback(() => {
- setShowOldTraceDetails(true);
- }, []);
- return showOldTraceDetails ? (
- <TraceDetail />
- ) : (
- <NewTraceDetail items={items} handleOldTraceDetails={handleOldTraceDetails} />
- );
+ return <NewTraceDetail items={items} />;
}