mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 04:39:01 +08:00
Merge branch 'pranshuchittora/fix/trace-detail/events-error-handling' of github.com:pranshuchittora/signoz into pranshuchittora/fix/trace-detail/events-error-handling
This commit is contained in:
commit
112766b265
@ -1,10 +1,11 @@
|
||||
import React, { useState, useMemo, useEffect } from 'react';
|
||||
import styles from './style.module.css';
|
||||
import { useMeasure } from 'react-use';
|
||||
import { INTERVAL_UNITS } from 'container/TraceDetail/utils';
|
||||
import useThemeMode from 'hooks/useThemeMode';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useMeasure } from 'react-use';
|
||||
|
||||
import styles from './style.module.css';
|
||||
import { Interval } from './types';
|
||||
import { getIntervalSpread, getIntervals } from './utils';
|
||||
import { getIntervals, getIntervalSpread } from './utils';
|
||||
|
||||
const Timeline_Height = 22;
|
||||
const Timeline_H_Spacing = 0;
|
||||
@ -13,7 +14,7 @@ const Timeline = ({
|
||||
traceMetaData,
|
||||
globalTraceMetadata,
|
||||
setIntervalUnit,
|
||||
}: TimelineProps) => {
|
||||
}: TimelineProps): JSX.Element => {
|
||||
const [ref, { width }] = useMeasure<HTMLDivElement>();
|
||||
const { isDarkMode } = useThemeMode();
|
||||
|
||||
@ -30,7 +31,7 @@ const Timeline = ({
|
||||
});
|
||||
|
||||
let intervalUnit = INTERVAL_UNITS[0];
|
||||
for (const idx in INTERVAL_UNITS) {
|
||||
for (let idx = 0; idx < INTERVAL_UNITS.length; idx++) {
|
||||
const standard_interval = INTERVAL_UNITS[idx];
|
||||
if (baseSpread * standard_interval.multiplier < 1) {
|
||||
if (idx > 1) intervalUnit = INTERVAL_UNITS[idx - 1];
|
||||
@ -38,8 +39,7 @@ const Timeline = ({
|
||||
}
|
||||
}
|
||||
|
||||
debugger;
|
||||
intervalUnit = intervalUnit || INTERVAL_UNITS[0]
|
||||
intervalUnit = intervalUnit || INTERVAL_UNITS[0];
|
||||
setIntervals(
|
||||
getIntervals({
|
||||
baseInterval,
|
||||
@ -49,7 +49,7 @@ const Timeline = ({
|
||||
}),
|
||||
);
|
||||
setIntervalUnit(intervalUnit);
|
||||
}, [traceMetaData, globalTraceMetadata]);
|
||||
}, [traceMetaData, globalTraceMetadata, setIntervalUnit]);
|
||||
|
||||
return (
|
||||
<div ref={ref} style={{ flex: 1, overflow: 'inherit' }}>
|
||||
|
@ -1,9 +1,11 @@
|
||||
import { isEqual } from 'lodash-es';
|
||||
import { toFixed } from 'utils/toFixed';
|
||||
import {
|
||||
INTERVAL_UNITS,
|
||||
resolveTimeFromInterval,
|
||||
} from 'container/TraceDetail/utils';
|
||||
import { isEqual } from 'lodash-es';
|
||||
import { toFixed } from 'utils/toFixed';
|
||||
|
||||
import { Interval } from './types';
|
||||
|
||||
export const getIntervalSpread = ({
|
||||
localTraceMetaData,
|
||||
@ -24,7 +26,7 @@ export const getIntervalSpread = ({
|
||||
|
||||
const MIN_INTERVALS = 5;
|
||||
const baseSpread = localSpread;
|
||||
let intervalSpread = (baseSpread / MIN_INTERVALS) * 1.0;
|
||||
const intervalSpread = (baseSpread / MIN_INTERVALS) * 1.0;
|
||||
const integerPartString = intervalSpread.toString().split('.')[0];
|
||||
const integerPartLength = integerPartString.length;
|
||||
const intervalSpreadNormalized =
|
||||
@ -46,7 +48,6 @@ export const getIntervals = ({
|
||||
intervalSpreadNormalized,
|
||||
intervalUnit,
|
||||
}) => {
|
||||
debugger
|
||||
const intervals: Interval[] = [
|
||||
{
|
||||
label: `${toFixed(resolveTimeFromInterval(baseInterval, intervalUnit), 2)}${
|
||||
@ -69,7 +70,6 @@ export const getIntervals = ({
|
||||
tempBaseSpread -= intervalSpreadNormalized;
|
||||
}
|
||||
elapsedIntervals = interval_time;
|
||||
debugger;
|
||||
const interval: Interval = {
|
||||
label: `${toFixed(
|
||||
resolveTimeFromInterval(interval_time + baseInterval, intervalUnit),
|
||||
|
Loading…
x
Reference in New Issue
Block a user