From 6247cb840ff7a9d289890951ad353214ab095f66 Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Tue, 28 Jan 2025 22:16:08 +0100 Subject: [PATCH] Hide Performance Anomaly trace buttons if there are no traces --- .../SpanPerformanceAnomalyInsightCard/index.tsx | 10 ++++++++-- src/components/Insights/types.ts | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpanPerformanceAnomalyInsightCard/index.tsx b/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpanPerformanceAnomalyInsightCard/index.tsx index 0f7732e6c..b0e9a9b91 100644 --- a/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpanPerformanceAnomalyInsightCard/index.tsx +++ b/src/components/Insights/InsightsCatalog/InsightsPage/InsightCardRenderer/insightCards/SpanPerformanceAnomalyInsightCard/index.tsx @@ -37,10 +37,16 @@ export const SpanPerformanceAnomalyInsightCard = ({ }; const handleGoToP50Trace = () => { + if (!insight.p50TraceId) { + return; + } goToTrace(insight.p50TraceId); }; const handleGoToP95Trace = () => { + if (!insight.p95TraceId) { + return; + } goToTrace(insight.p95TraceId); }; @@ -79,8 +85,8 @@ export const SpanPerformanceAnomalyInsightCard = ({ viewMode={viewMode} onDismissalChange={onDismissalChange} tooltipBoundaryRef={tooltipBoundaryRef} - onGoToP50Trace={handleGoToP50Trace} - onGoToP95Trace={handleGoToP95Trace} + onGoToP50Trace={insight.p50TraceId ? handleGoToP50Trace : undefined} + onGoToP95Trace={insight.p50TraceId ? handleGoToP95Trace : undefined} onOpenHistogram={onHistogramButtonClick} onJiraButtonClick={handleTicketInfoButtonClick} jiraTicketInfo={{ diff --git a/src/components/Insights/types.ts b/src/components/Insights/types.ts index e1cbec422..9440ce89e 100644 --- a/src/components/Insights/types.ts +++ b/src/components/Insights/types.ts @@ -698,6 +698,6 @@ export interface SpanPerformanceAnomalyInsight extends SpanInsight { p50: Duration; p95: Duration; slowerByPercentage: number; - p50TraceId: string; - p95TraceId: string; + p50TraceId: string | null; + p95TraceId: string | null; }