feat(rate-limits): use 1m buckets and 24h/3d ranges

Allow overview bucket_minutes=1; rate-limit analysis uses 1-minute
buckets and replaces 7d preset with 3 days.
This commit is contained in:
ryan
2026-07-19 19:20:59 +08:00
parent b56290d79d
commit 72962beb0f
6 changed files with 12 additions and 12 deletions
@@ -11,10 +11,10 @@ import { calculateNiceAxisMax, formatCompactNumber } from '@/lib/utils/metrics';
import {
formatOverviewTrendLabel,
type OverviewRangeHours,
type RateLimitRangeHours,
} from '../../access-logs/components/access-log-utils';
const DEFAULT_BUCKET_SECONDS = 300;
const DEFAULT_BUCKET_SECONDS = 60;
const RPS_COLOR = '#38bdf8';
const VISITS_COLOR = '#a78bfa';
@@ -54,14 +54,14 @@ function formatRps(value: number) {
type RatePressureChartProps = {
data?: AccessLogOverview;
hours: OverviewRangeHours;
hours: RateLimitRangeHours;
};
export function RatePressureChart({ data, hours }: RatePressureChartProps) {
const bucketSeconds =
(data?.bucket_minutes && data.bucket_minutes > 0
? data.bucket_minutes
: 5) * 60 || DEFAULT_BUCKET_SECONDS;
: 1) * 60 || DEFAULT_BUCKET_SECONDS;
const rangeLabel = useMemo(() => {
const end = data?.generated_at ? new Date(data.generated_at) : new Date();