mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-21 05:46:11 +08:00
(ui): Fix QueueSizeMetricsChart
This commit is contained in:
@@ -13,6 +13,10 @@ import { Metrics } from "../api";
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: Metrics[];
|
data: Metrics[];
|
||||||
|
|
||||||
|
// both startTime and endTime are in unix time (seconds)
|
||||||
|
startTime: number;
|
||||||
|
endTime: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// interface that rechart understands.
|
// interface that rechart understands.
|
||||||
@@ -58,9 +62,12 @@ function QueueSizeMetricsChart(props: Props) {
|
|||||||
<XAxis
|
<XAxis
|
||||||
minTickGap={10}
|
minTickGap={10}
|
||||||
dataKey="timestamp"
|
dataKey="timestamp"
|
||||||
|
domain={[props.startTime, props.endTime]}
|
||||||
tickFormatter={(timestamp: number) =>
|
tickFormatter={(timestamp: number) =>
|
||||||
new Date(timestamp * 1000).toLocaleTimeString()
|
new Date(timestamp * 1000).toLocaleTimeString()
|
||||||
}
|
}
|
||||||
|
type="number"
|
||||||
|
scale="time"
|
||||||
/>
|
/>
|
||||||
<YAxis />
|
<YAxis />
|
||||||
<Tooltip
|
<Tooltip
|
||||||
|
@@ -140,6 +140,8 @@ function MetricsView(props: Props) {
|
|||||||
}
|
}
|
||||||
}, [pollInterval, getMetricsAsync, durationSec, endTimeSec, endTimeOption]);
|
}, [pollInterval, getMetricsAsync, durationSec, endTimeSec, endTimeOption]);
|
||||||
|
|
||||||
|
const now = currentUnixtime();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container maxWidth="lg" className={classes.container}>
|
<Container maxWidth="lg" className={classes.container}>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
@@ -322,7 +324,15 @@ function MetricsView(props: Props) {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
<Typography>Queue Size</Typography>
|
<Typography>Queue Size</Typography>
|
||||||
<QueueSizeMetricsChart data={data?.data.result || []} />
|
<QueueSizeMetricsChart
|
||||||
|
data={data?.data.result || []}
|
||||||
|
endTime={endTimeOption === "real_time" ? now : endTimeSec}
|
||||||
|
startTime={
|
||||||
|
endTimeOption === "real_time"
|
||||||
|
? now - durationSec
|
||||||
|
: endTimeSec - durationSec
|
||||||
|
}
|
||||||
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
|
Reference in New Issue
Block a user