feat(rate-limits): use 3-minute trend buckets

Rate-limit analysis requests overview with bucket_minutes=3; RPS uses
count/180. Overview still defaults to 60-minute buckets.
This commit is contained in:
ryan
2026-07-19 20:30:20 +08:00
parent abe8fb8268
commit 20249d917c
5 changed files with 7 additions and 7 deletions
@@ -14,7 +14,7 @@ import {
type RateLimitRangeHours,
} from '../../access-logs/components/access-log-utils';
const DEFAULT_BUCKET_SECONDS = 60;
const DEFAULT_BUCKET_SECONDS = 180;
const RPS_COLOR = '#38bdf8';
const VISITS_COLOR = '#a78bfa';
@@ -61,7 +61,7 @@ export function RatePressureChart({ data, hours }: RatePressureChartProps) {
const bucketSeconds =
(data?.bucket_minutes && data.bucket_minutes > 0
? data.bucket_minutes
: 1) * 60 || DEFAULT_BUCKET_SECONDS;
: 3) * 60 || DEFAULT_BUCKET_SECONDS;
const rangeLabel = useMemo(() => {
const end = data?.generated_at ? new Date(data.generated_at) : new Date();
+2 -2
View File
@@ -31,12 +31,12 @@ function RateLimitsPageContent() {
const [hosts, setHosts] = useState<string[]>([]);
const overviewQuery = useQuery({
queryKey: ['openflare', 'rate-limits', 'overview', hours, hosts, 1],
queryKey: ['openflare', 'rate-limits', 'overview', hours, hosts, 3],
queryFn: () =>
AccessLogService.getOverview({
hours,
hosts: hosts.length > 0 ? hosts : undefined,
bucket_minutes: 1,
bucket_minutes: 3,
}),
enabled: !!user?.is_admin && tab === 'analysis',
});