diff --git a/packages/web-console/src/scenes/Editor/Metrics/index.tsx b/packages/web-console/src/scenes/Editor/Metrics/index.tsx index 84802c93b..4bcd00589 100644 --- a/packages/web-console/src/scenes/Editor/Metrics/index.tsx +++ b/packages/web-console/src/scenes/Editor/Metrics/index.tsx @@ -115,12 +115,6 @@ export const Metrics = () => { : refreshRatesInSeconds[refreshRate] : 0 - const rollingAppendLimit = getRollingAppendRowLimit( - refreshRateInSec, - dateFrom, - dateTo, - ) - const updateMetrics = (metrics: Metric[]) => { if (buffer?.id) { updateBuffer(buffer?.id, { @@ -419,7 +413,7 @@ export const Metrics = () => { onTableChange={handleTableChange} onColorChange={handleColorChange} fetchMode={fetchModeRef.current} - rollingAppendLimit={rollingAppendLimit} + refreshRateInSec={refreshRateInSec} /> ))} diff --git a/packages/web-console/src/scenes/Editor/Metrics/metric.tsx b/packages/web-console/src/scenes/Editor/Metrics/metric.tsx index e2a157cc0..e0c4bc18c 100644 --- a/packages/web-console/src/scenes/Editor/Metrics/metric.tsx +++ b/packages/web-console/src/scenes/Editor/Metrics/metric.tsx @@ -8,6 +8,7 @@ import { getTimeFilter, getSamplingRateForPeriod, durationTokenToDate, + getRollingAppendRowLimit, } from "./utils" import type { DateRange, @@ -52,14 +53,14 @@ export const Metric = ({ onTableChange, onColorChange, fetchMode, - rollingAppendLimit, + refreshRateInSec, }: DateRange & { metric: MetricItem onRemove: (metric: MetricItem) => void onTableChange: (metric: MetricItem, tableId: number) => void onColorChange: (metric: MetricItem, color: string) => void fetchMode: FetchMode - rollingAppendLimit: number + refreshRateInSec: number }) => { const { quest } = useContext(QuestContext) const [loading, setLoading] = useState(metric.tableId !== undefined) @@ -85,6 +86,12 @@ export const Metric = ({ widgetConfig.querySupportsRollingAppend && fetchMode === FetchMode.ROLLING_APPEND + const rollingAppendLimit = getRollingAppendRowLimit( + refreshRateInSec, + dateFrom, + dateTo, + ) + const fetchMetric = async (overwrite?: boolean) => { setLoading(true) try {