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: update styles for percentile value (#9477)

Yunus Mf5bcd65e2edf
diff --git a/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.styles.scss b/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.styles.scss
index 5a06b43a7d..4cd534631d 100644
--- a/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.styles.scss
+++ b/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.styles.scss
@@ -68,23 +68,39 @@
display: inline-flex;
}
- .span-percentile-value {
- color: var(--text-sakura-400, #f56c87);
- font-variant-numeric: lining-nums tabular-nums stacked-fractions
- slashed-zero;
- font-feature-settings: 'dlig' on, 'salt' on;
- font-family: Inter;
- font-size: 14px;
- font-style: normal;
- font-weight: 400;
- line-height: 18px; /* 128.571% */
- letter-spacing: -0.07px;
- min-width: 48px;
- padding: 4px 8px;
+ .span-percentile-value-container {
+ .span-percentile-value {
+ color: var(--text-sakura-400, #f56c87);
+ font-variant-numeric: lining-nums tabular-nums stacked-fractions
+ slashed-zero;
+ font-feature-settings: 'dlig' on, 'salt' on;
+
+ border-radius: 0 50px 50px 0;
+
+ font-family: Inter;
+ font-size: 14px;
+ font-style: normal;
+ font-weight: 400;
+ min-width: 48px;
+ padding-left: 8px;
+ padding-right: 8px;
+
+ border-left: 1px solid var(--bg-slate-400);
- border-left: 1px solid var(--bg-slate-400);
+ cursor: pointer;
- cursor: pointer;
+ display: inline-flex;
+ align-items: center;
+ word-break: normal;
+ gap: 6px;
+ }
+
+ &.span-percentile-value-container-open {
+ .span-percentile-value {
+ border: 1px solid var(--bg-slate-400);
+ background: var(--bg-slate-400);
+ }
+ }
}
}
@@ -605,6 +621,15 @@
.description {
.item {
.span-name-wrapper {
+ .span-percentile-value-container {
+ &.span-percentile-value-container-open {
+ .span-percentile-value {
+ border: 1px solid var(--bg-vanilla-200);
+ background: var(--bg-vanilla-200);
+ }
+ }
+ }
+
.span-percentile-value {
color: var(--text-sakura-400, #f56c87);
border-left: 1px solid var(--bg-slate-300);
diff --git a/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.tsx b/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.tsx
index 9dd55f2377..d73e207825 100644
--- a/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.tsx
+++ b/frontend/src/container/SpanDetailsDrawer/SpanDetailsDrawer.tsx
@@ -31,6 +31,7 @@ import {
Bookmark,
Check,
ChevronDown,
+ ChevronUp,
Link2,
Loader2,
PanelRight,
@@ -387,17 +388,24 @@ function SpanDetailsDrawer(props: ISpanDetailsDrawerProps): JSX.Element {
setShouldUpdateUserPreference(false);
}
},
+ keepPreviousData: false,
+ cacheTime: 0, // no cache
});
// Prod Req - Wait for 2 seconds before fetching span percentile data on initial load
useEffect(() => {
+ setSpanPercentileData(null);
+ setIsSpanPercentilesOpen(false);
setInitialWaitCompleted(false);
const timer = setTimeout(() => {
setInitialWaitCompleted(true);
}, 2000); // 2-second delay
- return (): void => clearTimeout(timer); // Cleanup on re-run or unmount
+ return (): void => {
+ // clean the old state around span percentile data
+ clearTimeout(timer); // Cleanup on re-run or unmount
+ };
}, [selectedSpan?.spanId]);
useEffect(() => {
@@ -538,6 +546,11 @@ function SpanDetailsDrawer(props: ISpanDetailsDrawerProps): JSX.Element {
initialWaitCompleted,
]);
+ const loadingSpanPercentilesData =
+ isLoadingSpanPercentilesData || isFetchingSpanPercentilesData;
+
+ const spanPercentileValue = Math.floor(spanPercentileData?.percentile || 0);
+
return (
<>
<section className="header">
@@ -566,25 +579,43 @@ function SpanDetailsDrawer(props: ISpanDetailsDrawerProps): JSX.Element {
</Typography.Text>
</Tooltip>
- {isLoadingSpanPercentilesData && (
+ {loadingSpanPercentilesData && (
<div className="loading-spinner-container">
<Loader2 size={16} className="animate-spin" />
</div>
)}
- {!isLoadingSpanPercentilesData && spanPercentileData && (
+ {!loadingSpanPercentilesData && spanPercentileData && (
<Tooltip
title={isSpanPercentilesOpen ? '' : spanPercentileTooltipText}
placement="bottomRight"
overlayClassName="span-percentile-tooltip"
arrow={false}
>
- <Typography.Text
- className="span-percentile-value"
- onClick={(): void => setIsSpanPercentilesOpen((prev) => !prev)}
+ <div
+ className={`span-percentile-value-container ${
+ isSpanPercentilesOpen
+ ? 'span-percentile-value-container-open'
+ : 'span-percentile-value-container-closed'
+ }`}
>
- p{Math.floor(spanPercentileData?.percentile || 0)}
- </Typography.Text>
+ <Typography.Text
+ className="span-percentile-value"
+ onClick={(): void => setIsSpanPercentilesOpen((prev) => !prev)}
+ disabled={loadingSpanPercentilesData}
+ >
+ <span className="span-percentile-value-text">
+ p{spanPercentileValue}
+ </span>
+
+ {!isSpanPercentilesOpen && (
+ <ChevronDown size={16} className="span-percentile-value-icon" />
+ )}
+ {isSpanPercentilesOpen && (
+ <ChevronUp size={16} className="span-percentile-value-icon" />
+ )}
+ </Typography.Text>
+ </div>
</Tooltip>
)}
</div>