Skip to content

Commit

Permalink
Set limit on the metric level
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Jan 13, 2025
1 parent de9bb00 commit 148bfbb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
8 changes: 1 addition & 7 deletions packages/web-console/src/scenes/Editor/Metrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -419,7 +413,7 @@ export const Metrics = () => {
onTableChange={handleTableChange}
onColorChange={handleColorChange}
fetchMode={fetchModeRef.current}
rollingAppendLimit={rollingAppendLimit}
refreshRateInSec={refreshRateInSec}
/>
))}
</Charts>
Expand Down
11 changes: 9 additions & 2 deletions packages/web-console/src/scenes/Editor/Metrics/metric.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
getTimeFilter,
getSamplingRateForPeriod,
durationTokenToDate,
getRollingAppendRowLimit,
} from "./utils"
import type {
DateRange,
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit 148bfbb

Please sign in to comment.