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.

feat: right dock span details (#11427)

Aditya Singh33b455406a51
diff --git a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/DockModeSwitcher.tsx b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/DockModeSwitcher.tsx
new file mode 100644
index 0000000000..017474405c
--- /dev/null
+++ b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/DockModeSwitcher.tsx
@@ -0,0 +1,77 @@
+import { ReactNode } from 'react';
+import { Dock, PanelBottom, PanelRight } from '@signozhq/icons';
+import { ToggleGroup, ToggleGroupItem } from '@signozhq/ui/toggle-group';
+import {
+ TooltipContent,
+ TooltipProvider,
+ TooltipRoot,
+ TooltipTrigger,
+} from '@signozhq/ui/tooltip';
+
+import { SpanDetailVariant } from './constants';
+
+interface DockOption {
+ value: SpanDetailVariant;
+ icon: ReactNode;
+ tooltip: string;
+}
+
+const DOCK_OPTIONS: DockOption[] = [
+ {
+ value: SpanDetailVariant.DIALOG,
+ icon: <Dock size={14} />,
+ tooltip: 'Open as floating panel',
+ },
+ {
+ value: SpanDetailVariant.DOCKED,
+ icon: <PanelBottom size={14} />,
+ tooltip: 'Dock at the bottom',
+ },
+ {
+ value: SpanDetailVariant.DOCKED_RIGHT,
+ icon: <PanelRight size={14} />,
+ tooltip: 'Dock on the right',
+ },
+];
+
+interface DockModeSwitcherProps {
+ value: SpanDetailVariant;
+ onChange: (value: SpanDetailVariant) => void;
+ tooltipClassName?: string;
+}
+
+function DockModeSwitcher({
+ value,
+ onChange,
+ tooltipClassName,
+}: DockModeSwitcherProps): JSX.Element {
+ return (
+ <TooltipProvider>
+ <ToggleGroup
+ type="single"
+ value={value}
+ onChange={(v): void => {
+ if (v) {
+ onChange(v as SpanDetailVariant);
+ }
+ }}
+ size="sm"
+ >
+ {DOCK_OPTIONS.map((option) => (
+ <TooltipRoot key={option.value}>
+ <TooltipTrigger asChild>
+ <span>
+ <ToggleGroupItem value={option.value}>{option.icon}</ToggleGroupItem>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent className={tooltipClassName}>
+ {option.tooltip}
+ </TooltipContent>
+ </TooltipRoot>
+ ))}
+ </ToggleGroup>
+ </TooltipProvider>
+ );
+}
+
+export default DockModeSwitcher;
diff --git a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.module.scss b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.module.scss
index 076355aa96..741d01647a 100644
--- a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.module.scss
+++ b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.module.scss
@@ -3,6 +3,10 @@
display: flex;
flex-direction: column;
overflow: hidden;
+
+ :global(.details-header) {
+ height: 39px;
+ }
}
.body {
diff --git a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.tsx b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.tsx
index 03dc80a006..f0aa945e6b 100644
--- a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.tsx
+++ b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.tsx
@@ -1,25 +1,16 @@
import { useCallback, useMemo } from 'react';
-import { Button } from '@signozhq/ui/button';
import {
TabsContent,
TabsList,
TabsRoot,
TabsTrigger,
} from '@signozhq/ui/tabs';
-import {
- TooltipRoot,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from '@signozhq/ui/tooltip';
import {
Bookmark,
CalendarClock,
ChartColumnBig,
- Dock,
Link2,
List,
- PanelBottom,
ScrollText,
Timer,
} from '@signozhq/icons';
@@ -61,6 +52,7 @@ import {
SpanDetailVariant,
VISIBLE_ACTIONS,
} from './constants';
+import DockModeSwitcher from './DockModeSwitcher';
import { useSpanAttributeActions } from './hooks/useSpanAttributeActions';
import { useTracePinnedFields } from './hooks/useTracePinnedFields';
import {
@@ -492,31 +484,14 @@ function SpanDetailsPanel({
];
if (onVariantChange) {
- const isDocked = variant === SpanDetailVariant.DOCKED;
actions.push({
- key: 'dock-toggle',
+ key: 'dock-mode',
component: (
- <TooltipProvider>
- <TooltipRoot>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- size="icon"
- color="secondary"
- onClick={(): void =>
- onVariantChange(
- isDocked ? SpanDetailVariant.DIALOG : SpanDetailVariant.DOCKED,
- )
- }
- >
- {isDocked ? <Dock size={14} /> : <PanelBottom size={14} />}
- </Button>
- </TooltipTrigger>
- <TooltipContent className={styles.dockToggleTooltip}>
- {isDocked ? 'Open as floating panel' : 'Dock at the bottom'}
- </TooltipContent>
- </TooltipRoot>
- </TooltipProvider>
+ <DockModeSwitcher
+ value={variant}
+ onChange={onVariantChange}
+ tooltipClassName={styles.dockToggleTooltip}
+ />
),
});
}
@@ -553,7 +528,10 @@ function SpanDetailsPanel({
</>
);
- if (variant === SpanDetailVariant.DOCKED) {
+ if (
+ variant === SpanDetailVariant.DOCKED ||
+ variant === SpanDetailVariant.DOCKED_RIGHT
+ ) {
return <div className={styles.root}>{content}</div>;
}
diff --git a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/constants.ts b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/constants.ts
index 96315a4245..17cf0b38c6 100644
--- a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/constants.ts
+++ b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/constants.ts
@@ -22,6 +22,7 @@ export enum SpanDetailVariant {
DRAWER = 'drawer',
DIALOG = 'dialog',
DOCKED = 'docked',
+ DOCKED_RIGHT = 'right',
}
export const KEY_ATTRIBUTE_KEYS: Record<string, string[]> = {
diff --git a/frontend/src/pages/TraceDetailsV3/TraceDetailsV3.module.scss b/frontend/src/pages/TraceDetailsV3/TraceDetailsV3.module.scss
index dd66e107ed..940942d80c 100644
--- a/frontend/src/pages/TraceDetailsV3/TraceDetailsV3.module.scss
+++ b/frontend/src/pages/TraceDetailsV3/TraceDetailsV3.module.scss
@@ -4,13 +4,28 @@
flex-direction: column;
}
+.layoutRow {
+ display: flex;
+ flex: 1;
+ min-height: 0;
+ overflow: hidden;
+}
+
.content {
display: flex;
flex-direction: column;
flex: 1;
+ min-width: 0;
overflow: hidden;
}
+.rightDock {
+ display: flex;
+ flex-direction: column;
+ border-left: 1px solid var(--l2-border);
+ min-width: 0;
+}
+
// Shared Ant Collapse chrome reset for both the flamegraph and waterfall
// collapse panels.
.flameCollapse,
diff --git a/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx b/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx
index 7e5e3afdd7..ad28350a63 100644
--- a/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx
+++ b/frontend/src/pages/TraceDetailsV3/TraceWaterfall/TraceWaterfallStates/Success/Success.tsx
@@ -893,7 +893,7 @@ function Success(props: ISuccessProps): JSX.Element {
/>
{/* Left panel - table with horizontal scroll */}
<ResizableBox
- direction="horizontal"
+ handle="right"
defaultWidth={DEFAULT_SIDEBAR_WIDTH}
minWidth={MIN_SIDEBAR_WIDTH}
maxWidth={MAX_SIDEBAR_WIDTH}
diff --git a/frontend/src/pages/TraceDetailsV3/index.tsx b/frontend/src/pages/TraceDetailsV3/index.tsx
index 0e6f45b188..1757c95501 100644
--- a/frontend/src/pages/TraceDetailsV3/index.tsx
+++ b/frontend/src/pages/TraceDetailsV3/index.tsx
@@ -242,9 +242,13 @@ function TraceDetailsV3(): JSX.Element {
() =>
(getLocalStorageKey(
LOCALSTORAGE.TRACE_DETAILS_SPAN_DETAILS_POSITION,
- ) as SpanDetailVariant) || SpanDetailVariant.DIALOG,
+ ) as SpanDetailVariant) || SpanDetailVariant.DOCKED_RIGHT,
);
+ const RIGHT_DOCK_MIN = 480;
+ const RIGHT_DOCK_MAX = 720;
+ const [rightDockWidth, setRightDockWidth] = useState(RIGHT_DOCK_MIN);
+
const handleVariantChange = useCallback(
(newVariant: SpanDetailVariant): void => {
setLocalStorageKey(
@@ -291,7 +295,9 @@ function TraceDetailsV3(): JSX.Element {
(!!errorFetchingTraceData || !traceData?.payload?.spans?.length);
const isDocked = spanDetailVariant === SpanDetailVariant.DOCKED;
+ const isRightDocked = spanDetailVariant === SpanDetailVariant.DOCKED_RIGHT;
const isWaterfallDocked = panelState.isOpen && isDocked;
+ const showRightDock = panelState.isOpen && isRightDocked;
const waterfallChildren = (
<ResizableBox
@@ -332,94 +338,118 @@ function TraceDetailsV3(): JSX.Element {
<NoData />
) : (
<>
- <div className={styles.content}>
- <Collapse
- // @ts-expect-error motion is passed through to rc-collapse to disable animation
- motion={false}
- activeKey={activeKeys.filter((k) => k === 'flame')}
- onChange={(): void => handleCollapseChange('flame')}
- size="small"
- className={styles.flameCollapse}
- items={[
- {
- key: 'flame',
- label: (
- <div className={styles.collapseLabel}>
- <span className={styles.collapseTitle}>
- Flame Graph
- {traceData?.payload?.totalSpansCount &&
- traceData.payload.totalSpansCount > FLAMEGRAPH_SPAN_LIMIT && (
- <WarningPopover
- message="The total span count exceeds the visualization limit. Displaying a sampled subset of spans in flamegraph."
- placement="bottomLeft"
- />
- )}
- </span>
- {traceData?.payload?.totalSpansCount ? (
- <span className={styles.collapseCount}>
- <span className={styles.collapseCountItem}>
- <ChartNoAxesGantt size={13} />
- Spans: {traceData.payload.totalSpansCount}
- </span>
- <span
- className={cx(styles.collapseCountItem, {
- [styles.hasErrors]: traceData.payload.totalErrorSpansCount > 0,
- })}
- >
- <TriangleAlert size={13} />
- Errors: {traceData.payload.totalErrorSpansCount ?? 0}
- </span>
+ <div className={styles.layoutRow}>
+ <div className={styles.content}>
+ <Collapse
+ // @ts-expect-error motion is passed through to rc-collapse to disable animation
+ motion={false}
+ activeKey={activeKeys.filter((k) => k === 'flame')}
+ onChange={(): void => handleCollapseChange('flame')}
+ size="small"
+ className={styles.flameCollapse}
+ items={[
+ {
+ key: 'flame',
+ label: (
+ <div className={styles.collapseLabel}>
+ <span className={styles.collapseTitle}>
+ Flame Graph
+ {traceData?.payload?.totalSpansCount &&
+ traceData.payload.totalSpansCount > FLAMEGRAPH_SPAN_LIMIT && (
+ <WarningPopover
+ message="The total span count exceeds the visualization limit. Displaying a sampled subset of spans in flamegraph."
+ placement="bottomLeft"
+ />
+ )}
</span>
- ) : null}
- </div>
- ),
- children: (
- <ResizableBox defaultHeight={300} minHeight={100} maxHeight={400}>
- <TraceFlamegraph
- filteredSpanIds={filteredSpanIds}
- isFilterActive={isFilterActive}
- selectedSpan={selectedSpan}
- totalSpansCount={totalSpansCount}
- />
- </ResizableBox>
- ),
- },
- ]}
- />
-
- <Collapse
- // @ts-expect-error motion is passed through to rc-collapse to disable animation
- motion={false}
- activeKey={activeKeys.filter((k) => k === 'waterfall')}
- onChange={(): void => handleCollapseChange('waterfall')}
- size="small"
- className={cx(styles.waterfallCollapse, {
- [styles.isDocked]: isWaterfallDocked,
- })}
- items={[
- {
- key: 'waterfall',
- label: 'Waterfall',
- children: activeKeys.includes('waterfall') ? waterfallChildren : null,
- },
- ]}
- />
-
- {panelState.isOpen && isDocked && (
- <div className={styles.dockedSpanDetails}>
+ {traceData?.payload?.totalSpansCount ? (
+ <span className={styles.collapseCount}>
+ <span className={styles.collapseCountItem}>
+ <ChartNoAxesGantt size={13} />
+ Spans: {traceData.payload.totalSpansCount}
+ </span>
+ <span
+ className={cx(styles.collapseCountItem, {
+ [styles.hasErrors]: traceData.payload.totalErrorSpansCount > 0,
+ })}
+ >
+ <TriangleAlert size={13} />
+ Errors: {traceData.payload.totalErrorSpansCount ?? 0}
+ </span>
+ </span>
+ ) : null}
+ </div>
+ ),
+ children: (
+ <ResizableBox defaultHeight={300} minHeight={100} maxHeight={400}>
+ <TraceFlamegraph
+ filteredSpanIds={filteredSpanIds}
+ isFilterActive={isFilterActive}
+ selectedSpan={selectedSpan}
+ totalSpansCount={totalSpansCount}
+ />
+ </ResizableBox>
+ ),
+ },
+ ]}
+ />
+
+ <Collapse
+ // @ts-expect-error motion is passed through to rc-collapse to disable animation
+ motion={false}
+ activeKey={activeKeys.filter((k) => k === 'waterfall')}
+ onChange={(): void => handleCollapseChange('waterfall')}
+ size="small"
+ className={cx(styles.waterfallCollapse, {
+ [styles.isDocked]: isWaterfallDocked,
+ })}
+ items={[
+ {
+ key: 'waterfall',
+ label: 'Waterfall',
+ children: activeKeys.includes('waterfall')
+ ? waterfallChildren
+ : null,
+ },
+ ]}
+ />
+
+ {panelState.isOpen && isDocked && (
+ <div className={styles.dockedSpanDetails}>
+ <SpanDetailsPanel
+ panelState={panelState}
+ selectedSpan={selectedSpan}
+ variant={SpanDetailVariant.DOCKED}
+ onVariantChange={handleVariantChange}
+ traceStartTime={traceData?.payload?.startTimestampMillis}
+ traceEndTime={traceData?.payload?.endTimestampMillis}
+ />
+ </div>
+ )}
+ </div>
+
+ {showRightDock && (
+ <ResizableBox
+ handle="left"
+ defaultWidth={rightDockWidth}
+ minWidth={RIGHT_DOCK_MIN}
+ maxWidth={RIGHT_DOCK_MAX}
+ onResize={setRightDockWidth}
+ className={styles.rightDock}
+ >
<SpanDetailsPanel
panelState={panelState}
selectedSpan={selectedSpan}
- variant={SpanDetailVariant.DOCKED}
+ variant={SpanDetailVariant.DOCKED_RIGHT}
onVariantChange={handleVariantChange}
traceStartTime={traceData?.payload?.startTimestampMillis}
traceEndTime={traceData?.payload?.endTimestampMillis}
/>
- </div>
+ </ResizableBox>
)}
</div>
- {panelState.isOpen && !isDocked && (
+ {panelState.isOpen && spanDetailVariant === SpanDetailVariant.DIALOG && (
<SpanDetailsPanel
panelState={panelState}
selectedSpan={selectedSpan}
diff --git a/frontend/src/periscope/components/ResizableBox/ResizableBox.styles.scss b/frontend/src/periscope/components/ResizableBox/ResizableBox.styles.scss
index 742bbe293e..a4630fafeb 100644
--- a/frontend/src/periscope/components/ResizableBox/ResizableBox.styles.scss
+++ b/frontend/src/periscope/components/ResizableBox/ResizableBox.styles.scss
@@ -23,20 +23,36 @@
background: var(--primary);
}
- &--vertical {
- bottom: 0;
+ &--top,
+ &--bottom {
left: 0;
right: 0;
height: 1px;
cursor: row-resize;
}
- &--horizontal {
- right: 0;
+ &--left,
+ &--right {
top: 0;
bottom: 0;
width: 1px;
cursor: col-resize;
}
+
+ &--top {
+ top: 0;
+ }
+
+ &--bottom {
+ bottom: 0;
+ }
+
+ &--left {
+ left: 0;
+ }
+
+ &--right {
+ right: 0;
+ }
}
}
diff --git a/frontend/src/periscope/components/ResizableBox/ResizableBox.tsx b/frontend/src/periscope/components/ResizableBox/ResizableBox.tsx
index 23ae5c9fa4..c2b8aec19c 100644
--- a/frontend/src/periscope/components/ResizableBox/ResizableBox.tsx
+++ b/frontend/src/periscope/components/ResizableBox/ResizableBox.tsx
@@ -2,9 +2,15 @@ import { useCallback, useRef, useState } from 'react';
import './ResizableBox.styles.scss';
+export type ResizableBoxHandle = 'top' | 'right' | 'bottom' | 'left';
+
export interface ResizableBoxProps {
children: React.ReactNode;
- direction?: 'vertical' | 'horizontal';
+ // Which edge the resize handle sits on. The edge determines the axis:
+ // 'top'/'bottom' → vertical resize (height), 'left'/'right' → horizontal
+ // resize (width). Dragging the handle away from the content grows the box;
+ // dragging it toward the content shrinks it.
+ handle?: ResizableBoxHandle;
defaultHeight?: number;
minHeight?: number;
maxHeight?: number;
@@ -18,7 +24,7 @@ export interface ResizableBoxProps {
function ResizableBox({
children,
- direction = 'vertical',
+ handle = 'bottom',
defaultHeight = 200,
minHeight = 50,
maxHeight = Infinity,
@@ -29,7 +35,8 @@ function ResizableBox({
disabled = false,
className,
}: ResizableBoxProps): JSX.Element {
- const isHorizontal = direction === 'horizontal';
+ const isHorizontal = handle === 'left' || handle === 'right';
+ const isStartHandle = handle === 'top' || handle === 'left';
const [size, setSize] = useState(isHorizontal ? defaultWidth : defaultHeight);
const containerRef = useRef<HTMLDivElement>(null);
@@ -40,10 +47,13 @@ function ResizableBox({
const startSize = size;
const min = isHorizontal ? minWidth : minHeight;
const max = isHorizontal ? maxWidth : maxHeight;
+ // Start-edge handle: pointer moving away from content (negative delta)
+ // grows the box, so invert the sign.
+ const deltaSign = isStartHandle ? -1 : 1;
const onMouseMove = (moveEvent: MouseEvent): void => {
const currentPos = isHorizontal ? moveEvent.clientX : moveEvent.clientY;
- const delta = currentPos - startPos;
+ const delta = (currentPos - startPos) * deltaSign;
const newSize = Math.min(max, Math.max(min, startSize + delta));
setSize(newSize);
onResize?.(newSize);
@@ -61,7 +71,16 @@ function ResizableBox({
document.addEventListener('mousemove', onMouseMove);
document.addEventListener('mouseup', onMouseUp);
},
- [size, isHorizontal, minWidth, maxWidth, minHeight, maxHeight, onResize],
+ [
+ size,
+ isHorizontal,
+ isStartHandle,
+ minWidth,
+ maxWidth,
+ minHeight,
+ maxHeight,
+ onResize,
+ ],
);
const containerStyle = disabled
@@ -69,7 +88,7 @@ function ResizableBox({
: isHorizontal
? { width: size }
: { height: size };
- const handleClass = `resizable-box__handle resizable-box__handle--${direction}`;
+ const handleClass = `resizable-box__handle resizable-box__handle--${handle}`;
return (
<div