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(trace-details): promote ExpandableValue to periscope + dropdown z-index fix (#11393)

Aditya Singha5adc52276ab
diff --git a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.module.scss b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.module.scss
index 4317947ea9..076355aa96 100644
--- a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.module.scss
+++ b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/SpanDetailsPanel.module.scss
@@ -119,6 +119,12 @@
flex-shrink: 0;
}
+.statusMessageBadge {
+ width: 100%;
+ min-width: 0;
+ box-sizing: border-box;
+}
+
.traceId {
color: var(--accent-primary);
overflow: hidden;
diff --git a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/config.tsx b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/config.tsx
index af007cd551..ae4828b3ca 100644
--- a/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/config.tsx
+++ b/frontend/src/pages/TraceDetailsV3/SpanDetailsPanel/config.tsx
@@ -1,5 +1,6 @@
import { ReactNode } from 'react';
import { Badge } from '@signozhq/ui/badge';
+import ExpandableValue from 'periscope/components/ExpandableValue';
import { SpanV3 } from 'types/api/trace/getTraceV3';
import styles from './SpanDetailsPanel.module.scss';
@@ -48,7 +49,15 @@ export const HIGHLIGHTED_OPTIONS: HighlightedOption[] = [
label: 'STATUS MESSAGE',
render: (span): ReactNode | null =>
span.status_message ? (
- <Badge color="vanilla">{span.status_message}</Badge>
+ <ExpandableValue value={span.status_message} title="Status message">
+ <Badge
+ color="vanilla"
+ textEllipsis="end"
+ className={styles.statusMessageBadge}
+ >
+ {span.status_message}
+ </Badge>
+ </ExpandableValue>
) : null,
},
];
diff --git a/frontend/src/pages/TraceDetailsV3/TraceDetailsHeader/TraceOptionsMenu.module.scss b/frontend/src/pages/TraceDetailsV3/TraceDetailsHeader/TraceOptionsMenu.module.scss
new file mode 100644
index 0000000000..6705346b2c
--- /dev/null
+++ b/frontend/src/pages/TraceDetailsV3/TraceDetailsHeader/TraceOptionsMenu.module.scss
@@ -0,0 +1,3 @@
+.traceOptionsDropdown {
+ z-index: 1100;
+}
diff --git a/frontend/src/pages/TraceDetailsV3/TraceDetailsHeader/TraceOptionsMenu.tsx b/frontend/src/pages/TraceDetailsV3/TraceDetailsHeader/TraceOptionsMenu.tsx
index f0b8f7a502..87d8fc2591 100644
--- a/frontend/src/pages/TraceDetailsV3/TraceDetailsHeader/TraceOptionsMenu.tsx
+++ b/frontend/src/pages/TraceDetailsV3/TraceDetailsHeader/TraceOptionsMenu.tsx
@@ -6,6 +6,8 @@ import { Ellipsis } from '@signozhq/icons';
import { useTraceStore } from '../stores/traceStore';
+import styles from './TraceOptionsMenu.module.scss';
+
interface TraceOptionsMenuProps {
showTraceDetails: boolean;
onToggleTraceDetails: () => void;
@@ -82,7 +84,11 @@ function TraceOptionsMenu({
]);
return (
- <Dropdown menu={{ items: menuItems }} align="start">
+ <Dropdown
+ menu={{ items: menuItems }}
+ align="start"
+ className={styles.traceOptionsDropdown}
+ >
<Button
variant="ghost"
size="icon"
diff --git a/frontend/src/periscope/components/ExpandableValue/ExpandableValue.module.scss b/frontend/src/periscope/components/ExpandableValue/ExpandableValue.module.scss
new file mode 100644
index 0000000000..b9ec0c11af
--- /dev/null
+++ b/frontend/src/periscope/components/ExpandableValue/ExpandableValue.module.scss
@@ -0,0 +1,49 @@
+.trigger {
+ display: block;
+ min-width: 0;
+ max-width: 100%;
+ overflow: hidden;
+
+ [data-truncated='true'] {
+ pointer-events: none;
+ }
+}
+
+.tooltipContent {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ max-width: 480px;
+ padding: 8px;
+}
+
+.preview {
+ margin: 0;
+ max-height: 220px;
+ overflow: auto;
+ white-space: pre-wrap;
+ word-break: break-word;
+ font-family: var(--font-family-mono, monospace);
+ font-size: 12px;
+ line-height: 1.4;
+}
+
+.expandButton {
+ align-self: flex-end;
+}
+
+.dialog {
+ max-width: 80vw;
+ width: 80vw;
+}
+
+.fullValue {
+ margin: 0;
+ max-height: 70vh;
+ overflow: auto;
+ white-space: pre-wrap;
+ word-break: break-word;
+ font-family: var(--font-family-mono, monospace);
+ font-size: 13px;
+ line-height: 1.5;
+}
diff --git a/frontend/src/periscope/components/ExpandableValue/ExpandableValue.tsx b/frontend/src/periscope/components/ExpandableValue/ExpandableValue.tsx
new file mode 100644
index 0000000000..7d52489680
--- /dev/null
+++ b/frontend/src/periscope/components/ExpandableValue/ExpandableValue.tsx
@@ -0,0 +1,78 @@
+import { ReactNode, useState } from 'react';
+import { Button } from '@signozhq/ui/button';
+import { DialogWrapper } from '@signozhq/ui/dialog';
+import {
+ TooltipContent,
+ TooltipProvider,
+ TooltipRoot,
+ TooltipTrigger,
+} from '@signozhq/ui/tooltip';
+import { Fullscreen } from '@signozhq/icons';
+
+import styles from './ExpandableValue.module.scss';
+
+const DEFAULT_THRESHOLD = 100;
+const DEFAULT_DIALOG_TITLE = 'Value';
+
+const DEFAULT_Z_INDEX = 1100;
+
+interface ExpandableValueProps {
+ value: string;
+ title?: string;
+ threshold?: number;
+ zIndex?: number;
+ children: ReactNode;
+}
+
+function ExpandableValue({
+ value,
+ title = DEFAULT_DIALOG_TITLE,
+ threshold = DEFAULT_THRESHOLD,
+ zIndex = DEFAULT_Z_INDEX,
+ children,
+}: ExpandableValueProps): JSX.Element {
+ const [isDialogOpen, setIsDialogOpen] = useState(false);
+
+ if (value.length <= threshold) {
+ return <>{children}</>;
+ }
+
+ return (
+ <TooltipProvider>
+ <TooltipRoot>
+ <TooltipTrigger asChild>
+ <span className={styles.trigger}>{children}</span>
+ </TooltipTrigger>
+ <TooltipContent
+ className={styles.tooltipContent}
+ side="top"
+ style={{ zIndex }}
+ >
+ <pre className={styles.preview}>{value}</pre>
+ <Button
+ variant="outlined"
+ color="secondary"
+ size="sm"
+ prefix={<Fullscreen size={14} />}
+ onClick={(): void => setIsDialogOpen(true)}
+ className={styles.expandButton}
+ >
+ Expand
+ </Button>
+ </TooltipContent>
+ </TooltipRoot>
+
+ <DialogWrapper
+ title={title}
+ open={isDialogOpen}
+ onOpenChange={setIsDialogOpen}
+ className={styles.dialog}
+ style={{ zIndex }}
+ >
+ <pre className={styles.fullValue}>{value}</pre>
+ </DialogWrapper>
+ </TooltipProvider>
+ );
+}
+
+export default ExpandableValue;
diff --git a/frontend/src/periscope/components/ExpandableValue/index.ts b/frontend/src/periscope/components/ExpandableValue/index.ts
new file mode 100644
index 0000000000..5bc01b01e1
--- /dev/null
+++ b/frontend/src/periscope/components/ExpandableValue/index.ts
@@ -0,0 +1 @@
+export { default } from './ExpandableValue';