From 8cb8beb63f866a258b95d4340aea736405dc5238 Mon Sep 17 00:00:00 2001 From: Shaheer Kochai Date: Tue, 28 Jan 2025 11:02:28 +0430 Subject: [PATCH] fix: adjust the buffer time for start and end time in trace to logs (#6953) --- .../TraceDetail/SelectedSpanDetails/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/container/TraceDetail/SelectedSpanDetails/index.tsx b/frontend/src/container/TraceDetail/SelectedSpanDetails/index.tsx index fadbf15f21..b7db93b80e 100644 --- a/frontend/src/container/TraceDetail/SelectedSpanDetails/index.tsx +++ b/frontend/src/container/TraceDetail/SelectedSpanDetails/index.tsx @@ -19,6 +19,8 @@ import Events from './Events'; import { CardContainer, CustomSubText, styles } from './styles'; import Tags from './Tags'; +const FIVE_MINUTES_IN_MS = 5 * 60 * 1000; + function SelectedSpanDetails(props: SelectedSpanDetailsProps): JSX.Element { const { maxTime, minTime } = useSelector( (state) => state.globalTime, @@ -86,10 +88,10 @@ function SelectedSpanDetails(props: SelectedSpanDetailsProps): JSX.Element { history.push( `${ROUTES.LOGS_EXPLORER}?${createQueryParams({ [QueryParams.compositeQuery]: JSON.stringify(query), - // we subtract 1000 milliseconds from the start time to handle the cases when the trace duration is in nanoseconds - [QueryParams.startTime]: traceStartTime - 1000, - // we add 1000 milliseconds to the end time for nano second duration traces - [QueryParams.endTime]: traceEndTime + 1000, + // we subtract 5 minutes from the start time to handle the cases when the trace duration is in nanoseconds + [QueryParams.startTime]: traceStartTime - FIVE_MINUTES_IN_MS, + // we add 5 minutes to the end time for nano second duration traces + [QueryParams.endTime]: traceEndTime + FIVE_MINUTES_IN_MS, })}`, ); };