mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-31 11:52:00 +08:00
feat: event time is updated when root span is missing
This commit is contained in:
parent
58ce838023
commit
dbba8b5b55
@ -1,6 +1,4 @@
|
|||||||
import { InfoCircleOutlined } from '@ant-design/icons';
|
import { Collapse } from 'antd';
|
||||||
import { Collapse, Popover, Space } from 'antd';
|
|
||||||
import { convertTimeToRelevantUnit } from 'container/TraceDetail/utils';
|
|
||||||
import useThemeMode from 'hooks/useThemeMode';
|
import useThemeMode from 'hooks/useThemeMode';
|
||||||
import keys from 'lodash-es/keys';
|
import keys from 'lodash-es/keys';
|
||||||
import map from 'lodash-es/map';
|
import map from 'lodash-es/map';
|
||||||
@ -9,6 +7,8 @@ import { ITraceTree } from 'types/api/trace/getTraceItem';
|
|||||||
|
|
||||||
import EllipsedButton from '../EllipsedButton';
|
import EllipsedButton from '../EllipsedButton';
|
||||||
import { CustomSubText, CustomSubTitle } from '../styles';
|
import { CustomSubText, CustomSubTitle } from '../styles';
|
||||||
|
import EventStartTime from './EventStartTime';
|
||||||
|
import RelativeStartTime from './RelativeStartTime';
|
||||||
|
|
||||||
const { Panel } = Collapse;
|
const { Panel } = Collapse;
|
||||||
|
|
||||||
@ -25,10 +25,6 @@ function ErrorTag({
|
|||||||
{map(event, ({ attributeMap, name, timeUnixNano }) => {
|
{map(event, ({ attributeMap, name, timeUnixNano }) => {
|
||||||
const attributes = keys(attributeMap);
|
const attributes = keys(attributeMap);
|
||||||
|
|
||||||
const { time, timeUnitName } = convertTimeToRelevantUnit(
|
|
||||||
timeUnixNano / 1e6 - firstSpanStartTime,
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Collapse
|
<Collapse
|
||||||
key={`${name}${JSON.stringify(attributeMap)}`}
|
key={`${name}${JSON.stringify(attributeMap)}`}
|
||||||
@ -39,18 +35,14 @@ function ErrorTag({
|
|||||||
header={name || attributeMap?.event}
|
header={name || attributeMap?.event}
|
||||||
key={name || attributeMap.event}
|
key={name || attributeMap.event}
|
||||||
>
|
>
|
||||||
<Space direction="horizontal" align="center">
|
{firstSpanStartTime ? (
|
||||||
<CustomSubTitle style={{ margin: 0 }} ellipsis>
|
<RelativeStartTime
|
||||||
Event Start Time
|
firstSpanStartTime={firstSpanStartTime}
|
||||||
</CustomSubTitle>
|
timeUnixNano={timeUnixNano}
|
||||||
<Popover content="Relative to start of the full trace">
|
/>
|
||||||
<InfoCircleOutlined />
|
) : (
|
||||||
</Popover>
|
<EventStartTime timeUnixNano={timeUnixNano} />
|
||||||
</Space>
|
)}
|
||||||
|
|
||||||
<CustomSubText isDarkMode={isDarkMode}>
|
|
||||||
{`${time.toFixed(2)} ${timeUnitName}`}
|
|
||||||
</CustomSubText>
|
|
||||||
|
|
||||||
{map(attributes, (event) => {
|
{map(attributes, (event) => {
|
||||||
const value = attributeMap[event];
|
const value = attributeMap[event];
|
||||||
@ -93,7 +85,11 @@ interface ErrorTagProps {
|
|||||||
event: ITraceTree['event'];
|
event: ITraceTree['event'];
|
||||||
onToggleHandler: (isOpen: boolean) => void;
|
onToggleHandler: (isOpen: boolean) => void;
|
||||||
setText: (text: { subText: string; text: string }) => void;
|
setText: (text: { subText: string; text: string }) => void;
|
||||||
firstSpanStartTime: number;
|
firstSpanStartTime?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorTag.defaultProps = {
|
||||||
|
firstSpanStartTime: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
export default ErrorTag;
|
export default ErrorTag;
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
import { Popover } from 'antd';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import useThemeMode from 'hooks/useThemeMode';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { CustomSubText, CustomSubTitle } from '../styles';
|
||||||
|
|
||||||
|
function EventStartTime({ timeUnixNano }: EventStartTimeProps): JSX.Element {
|
||||||
|
const { isDarkMode } = useThemeMode();
|
||||||
|
|
||||||
|
const humanReadableTimeInDayJs = dayjs(timeUnixNano / 1e6).format(
|
||||||
|
'YYYY-MM-DD hh:mm:ss.SSS A',
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<CustomSubTitle style={{ margin: 0 }}>Event Time</CustomSubTitle>
|
||||||
|
<CustomSubText ellipsis isDarkMode={isDarkMode}>
|
||||||
|
<Popover content={humanReadableTimeInDayJs}>
|
||||||
|
{humanReadableTimeInDayJs}
|
||||||
|
</Popover>
|
||||||
|
</CustomSubText>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EventStartTimeProps {
|
||||||
|
timeUnixNano: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EventStartTime;
|
@ -0,0 +1,42 @@
|
|||||||
|
import { InfoCircleOutlined } from '@ant-design/icons';
|
||||||
|
import { Popover, Space } from 'antd';
|
||||||
|
import { convertTimeToRelevantUnit } from 'container/TraceDetail/utils';
|
||||||
|
import useThemeMode from 'hooks/useThemeMode';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { CustomSubText, CustomSubTitle } from '../styles';
|
||||||
|
|
||||||
|
function StartTime({
|
||||||
|
firstSpanStartTime,
|
||||||
|
timeUnixNano,
|
||||||
|
}: StartTimeProps): JSX.Element {
|
||||||
|
const { isDarkMode } = useThemeMode();
|
||||||
|
|
||||||
|
const { time, timeUnitName } = convertTimeToRelevantUnit(
|
||||||
|
timeUnixNano / 1e6 - (firstSpanStartTime || 0),
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Space direction="horizontal" align="center">
|
||||||
|
<CustomSubTitle style={{ margin: 0 }} ellipsis>
|
||||||
|
Event Start Time
|
||||||
|
</CustomSubTitle>
|
||||||
|
<Popover content="Relative to start of the full trace">
|
||||||
|
<InfoCircleOutlined />
|
||||||
|
</Popover>
|
||||||
|
</Space>
|
||||||
|
|
||||||
|
<CustomSubText isDarkMode={isDarkMode}>
|
||||||
|
{`${time.toFixed(2)} ${timeUnitName}`}
|
||||||
|
</CustomSubText>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface StartTimeProps {
|
||||||
|
timeUnixNano: number;
|
||||||
|
firstSpanStartTime: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StartTime;
|
@ -76,7 +76,7 @@ function TraceDetail({ response }: TraceDetailProps): JSX.Element {
|
|||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
}, [treesData, spanServiceColors]);
|
}, [treesData, spanServiceColors]);
|
||||||
|
|
||||||
const firstSpanStartTime = tree.spanTree[0].startTime;
|
const firstSpanStartTime = tree.spanTree[0]?.startTime;
|
||||||
|
|
||||||
const [globalTraceMetadata] = useState<ITraceMetaData>({
|
const [globalTraceMetadata] = useState<ITraceMetaData>({
|
||||||
...traceMetaData,
|
...traceMetaData,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user