diff --git a/src/components/Insights/EndpointNPlusOneInsight/index.tsx b/src/components/Insights/EndpointNPlusOneInsight/index.tsx index f130cb78f..82f6b62f6 100644 --- a/src/components/Insights/EndpointNPlusOneInsight/index.tsx +++ b/src/components/Insights/EndpointNPlusOneInsight/index.tsx @@ -1,5 +1,6 @@ import { useContext } from "react"; import { usePagination } from "../../../hooks/usePagination"; +import { InsightType } from "../../../types"; import { roundTo } from "../../../utils/roundTo"; import { ConfigContext } from "../../common/App/ConfigContext"; import { Pagination } from "../../common/Pagination"; @@ -29,8 +30,12 @@ export const EndpointNPlusOneInsight = ( props.onAssetLinkClick(spanCodeObjectId); }; - const handleTraceButtonClick = (trace: Trace) => { - props.onTraceButtonClick(trace, props.insight.type); + const handleTraceButtonClick = ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId: string + ) => { + props.onTraceButtonClick(trace, insightType, spanCodeObjectId); }; return ( @@ -83,10 +88,14 @@ export const EndpointNPlusOneInsight = ( - handleTraceButtonClick({ - name: spanName, - id: span.traceId - }) + handleTraceButtonClick( + { + name: spanName, + id: span.traceId + }, + props.insight.type, + spanInfo.spanCodeObjectId + ) } > Trace diff --git a/src/components/Insights/EndpointNPlusOneInsight/types.ts b/src/components/Insights/EndpointNPlusOneInsight/types.ts index fc770fd1a..1892cf6f4 100644 --- a/src/components/Insights/EndpointNPlusOneInsight/types.ts +++ b/src/components/Insights/EndpointNPlusOneInsight/types.ts @@ -8,5 +8,9 @@ import { export interface EndpointNPlusOneInsightProps extends InsightProps { insight: EndpointSuspectedNPlusOneInsight; onAssetLinkClick: (spanCodeObjectId: string) => void; - onTraceButtonClick: (trace: Trace, insightType: InsightType) => void; + onTraceButtonClick: ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId: string + ) => void; } diff --git a/src/components/Insights/ExcessiveAPICallsInsight/index.tsx b/src/components/Insights/ExcessiveAPICallsInsight/index.tsx index e880d9fe7..92add716a 100644 --- a/src/components/Insights/ExcessiveAPICallsInsight/index.tsx +++ b/src/components/Insights/ExcessiveAPICallsInsight/index.tsx @@ -1,5 +1,6 @@ import { useContext } from "react"; import { usePagination } from "../../../hooks/usePagination"; +import { InsightType } from "../../../types"; import { ConfigContext } from "../../common/App/ConfigContext"; import { Pagination } from "../../common/Pagination"; import { Tooltip } from "../../common/Tooltip"; @@ -27,8 +28,12 @@ export const ExcessiveAPICallsInsight = ( props.onAssetLinkClick(spanCodeObjectId); }; - const handleTraceButtonClick = (trace: Trace) => { - props.onTraceButtonClick(trace, props.insight.type); + const handleTraceButtonClick = ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId: string + ) => { + props.onTraceButtonClick(trace, insightType, spanCodeObjectId); }; return ( @@ -58,10 +63,14 @@ export const ExcessiveAPICallsInsight = ( - handleTraceButtonClick({ - name: spanName, - id: traceId - }) + handleTraceButtonClick( + { + name: spanName, + id: traceId + }, + props.insight.type, + spanCodeObjectId + ) } > Trace diff --git a/src/components/Insights/ExcessiveAPICallsInsight/types.ts b/src/components/Insights/ExcessiveAPICallsInsight/types.ts index a5b92caea..f778bb5e8 100644 --- a/src/components/Insights/ExcessiveAPICallsInsight/types.ts +++ b/src/components/Insights/ExcessiveAPICallsInsight/types.ts @@ -4,5 +4,9 @@ import { ChattyApiEndpointInsight, InsightProps, Trace } from "../types"; export interface ExcessiveAPICallsInsightProps extends InsightProps { insight: ChattyApiEndpointInsight; onAssetLinkClick: (spanCodeObjectId: string) => void; - onTraceButtonClick: (trace: Trace, insightType: InsightType) => void; + onTraceButtonClick: ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId: string + ) => void; } diff --git a/src/components/Insights/InsightList/index.tsx b/src/components/Insights/InsightList/index.tsx index 4ef93fcc6..7712fa264 100644 --- a/src/components/Insights/InsightList/index.tsx +++ b/src/components/Insights/InsightList/index.tsx @@ -251,12 +251,17 @@ const renderInsightCard = ( }); }; - const handleTraceButtonClick = (trace: Trace, insightType: InsightType) => { + const handleTraceButtonClick = ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId?: string + ) => { window.sendMessageToDigma({ action: actions.GO_TO_TRACE, payload: { trace, - insightType + insightType, + spanCodeObjectId } }); }; diff --git a/src/components/Insights/NPlusOneInsight/index.tsx b/src/components/Insights/NPlusOneInsight/index.tsx index 8c5837554..ca3e6dbe0 100644 --- a/src/components/Insights/NPlusOneInsight/index.tsx +++ b/src/components/Insights/NPlusOneInsight/index.tsx @@ -1,4 +1,5 @@ import { useContext } from "react"; +import { InsightType } from "../../../types"; import { trimEndpointScheme } from "../../../utils/trimEndpointScheme"; import { ConfigContext } from "../../common/App/ConfigContext"; import { Tooltip } from "../../common/Tooltip"; @@ -16,8 +17,12 @@ export const NPlusOneInsight = (props: NPlusOneInsightProps) => { spanCodeObjectId && props.onAssetLinkClick(spanCodeObjectId); }; - const handleTraceButtonClick = (trace: Trace) => { - props.onTraceButtonClick(trace, props.insight.type); + const handleTraceButtonClick = ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId?: string + ) => { + props.onTraceButtonClick(trace, insightType, spanCodeObjectId); }; const spanName = props.insight.clientSpanName || undefined; @@ -45,10 +50,14 @@ export const NPlusOneInsight = (props: NPlusOneInsightProps) => { {config.isJaegerEnabled && traceId && ( - handleTraceButtonClick({ - name: spanName, - id: traceId - }) + handleTraceButtonClick( + { + name: spanName, + id: traceId + }, + props.insight.type, + spanCodeObjectId + ) } icon={{ component: CrosshairIcon }} > diff --git a/src/components/Insights/NPlusOneInsight/types.ts b/src/components/Insights/NPlusOneInsight/types.ts index 4c649fc17..cc11bd43b 100644 --- a/src/components/Insights/NPlusOneInsight/types.ts +++ b/src/components/Insights/NPlusOneInsight/types.ts @@ -4,5 +4,9 @@ import { InsightProps, SpanNPlusOneInsight, Trace } from "../types"; export interface NPlusOneInsightProps extends InsightProps { insight: SpanNPlusOneInsight; onAssetLinkClick: (spanCodeObjectId: string) => void; - onTraceButtonClick: (trace: Trace, insightType: InsightType) => void; + onTraceButtonClick: ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId?: string + ) => void; } diff --git a/src/components/Insights/ScalingIssueInsight/index.tsx b/src/components/Insights/ScalingIssueInsight/index.tsx index 7a520a81f..77b830e2d 100644 --- a/src/components/Insights/ScalingIssueInsight/index.tsx +++ b/src/components/Insights/ScalingIssueInsight/index.tsx @@ -1,4 +1,5 @@ import { useContext } from "react"; +import { InsightType } from "../../../types"; import { trimEndpointScheme } from "../../../utils/trimEndpointScheme"; import { ConfigContext } from "../../common/App/ConfigContext"; import { Button } from "../../common/Button"; @@ -18,8 +19,12 @@ export const ScalingIssueInsight = (props: ScalingIssueInsightProps) => { props.onAssetLinkClick(spanCodeObjectId); }; - const handleTraceButtonClick = (trace: Trace) => { - props.onTraceButtonClick(trace, props.insight.type); + const handleTraceButtonClick = ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId: string + ) => { + props.onTraceButtonClick(trace, insightType, spanCodeObjectId); }; const handleHistogramButtonClick = () => { @@ -75,10 +80,14 @@ export const ScalingIssueInsight = (props: ScalingIssueInsightProps) => { - handleTraceButtonClick({ - name: spanName, - id: traceId - }) + handleTraceButtonClick( + { + name: spanName, + id: traceId + }, + props.insight.type, + spanCodeObjectId + ) } > Trace diff --git a/src/components/Insights/ScalingIssueInsight/types.ts b/src/components/Insights/ScalingIssueInsight/types.ts index e8bdc4337..85c6d777a 100644 --- a/src/components/Insights/ScalingIssueInsight/types.ts +++ b/src/components/Insights/ScalingIssueInsight/types.ts @@ -4,7 +4,11 @@ import { InsightProps, SpanScalingBadlyInsight, Trace } from "../types"; export interface ScalingIssueInsightProps extends InsightProps { insight: SpanScalingBadlyInsight; onAssetLinkClick: (spanCodeObjectId: string) => void; - onTraceButtonClick: (trace: Trace, insightType: InsightType) => void; + onTraceButtonClick: ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId: string + ) => void; onHistogramButtonClick: ( instrumentationLibrary: string, name: string, diff --git a/src/components/Insights/SessionInViewInsight/index.tsx b/src/components/Insights/SessionInViewInsight/index.tsx index 2a2e5942e..067a569e3 100644 --- a/src/components/Insights/SessionInViewInsight/index.tsx +++ b/src/components/Insights/SessionInViewInsight/index.tsx @@ -1,5 +1,6 @@ import { useContext } from "react"; import { usePagination } from "../../../hooks/usePagination"; +import { InsightType } from "../../../types"; import { ConfigContext } from "../../common/App/ConfigContext"; import { Pagination } from "../../common/Pagination"; import { Tooltip } from "../../common/Tooltip"; @@ -25,8 +26,12 @@ export const SessionInViewInsight = (props: SessionInViewInsightProps) => { props.onAssetLinkClick(spanCodeObjectId); }; - const handleTraceButtonClick = (trace: Trace) => { - props.onTraceButtonClick(trace, props.insight.type); + const handleTraceButtonClick = ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId: string + ) => { + props.onTraceButtonClick(trace, insightType, spanCodeObjectId); }; return ( @@ -56,10 +61,14 @@ export const SessionInViewInsight = (props: SessionInViewInsightProps) => { - handleTraceButtonClick({ - name: spanName, - id: traceId - }) + handleTraceButtonClick( + { + name: spanName, + id: traceId + }, + props.insight.type, + spanCodeObjectId + ) } > Trace diff --git a/src/components/Insights/SessionInViewInsight/types.ts b/src/components/Insights/SessionInViewInsight/types.ts index 67bbf31e5..6ade3519c 100644 --- a/src/components/Insights/SessionInViewInsight/types.ts +++ b/src/components/Insights/SessionInViewInsight/types.ts @@ -4,5 +4,9 @@ import { InsightProps, SessionInViewEndpointInsight, Trace } from "../types"; export interface SessionInViewInsightProps extends InsightProps { insight: SessionInViewEndpointInsight; onAssetLinkClick: (spanCodeObjectId: string) => void; - onTraceButtonClick: (trace: Trace, insightType: InsightType) => void; + onTraceButtonClick: ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId: string + ) => void; } diff --git a/src/components/Insights/TopUsageInsight/index.tsx b/src/components/Insights/TopUsageInsight/index.tsx index 2886fbce1..8241ae31d 100644 --- a/src/components/Insights/TopUsageInsight/index.tsx +++ b/src/components/Insights/TopUsageInsight/index.tsx @@ -1,5 +1,6 @@ import { useContext } from "react"; import { usePagination } from "../../../hooks/usePagination"; +import { InsightType } from "../../../types"; import { roundTo } from "../../../utils/roundTo"; import { ConfigContext } from "../../common/App/ConfigContext"; import { Pagination } from "../../common/Pagination"; @@ -25,8 +26,12 @@ export const TopUsageInsight = (props: TopUsageInsightProps) => { spanCodeObjectId && props.onAssetLinkClick(spanCodeObjectId); }; - const handleTraceButtonClick = (trace: Trace) => { - props.onTraceButtonClick(trace, props.insight.type); + const handleTraceButtonClick = ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId: string + ) => { + props.onTraceButtonClick(trace, insightType, spanCodeObjectId); }; return ( @@ -82,10 +87,14 @@ export const TopUsageInsight = (props: TopUsageInsightProps) => { - handleTraceButtonClick({ - name: firstServiceName, - id: traceId - }) + handleTraceButtonClick( + { + name: firstServiceName, + id: traceId + }, + props.insight.type, + flow.firstService.spanCodeObjectId + ) } > Trace diff --git a/src/components/Insights/TopUsageInsight/types.ts b/src/components/Insights/TopUsageInsight/types.ts index c95b119e6..5821660b8 100644 --- a/src/components/Insights/TopUsageInsight/types.ts +++ b/src/components/Insights/TopUsageInsight/types.ts @@ -4,5 +4,9 @@ import { InsightProps, SpanUsagesInsight, Trace } from "../types"; export interface TopUsageInsightProps extends InsightProps { insight: SpanUsagesInsight; onAssetLinkClick: (spanCodeObjectId: string) => void; - onTraceButtonClick: (trace: Trace, insightType: InsightType) => void; + onTraceButtonClick: ( + trace: Trace, + insightType: InsightType, + spanCodeObjectId: string + ) => void; }