forked from wrenn/wrenn
v0.1.0 (#17)
This commit is contained in:
@ -15,11 +15,20 @@ export type MetricsResponse = {
|
||||
points: MetricPoint[];
|
||||
};
|
||||
|
||||
export async function fetchSandboxMetrics(id: string, range: MetricRange): Promise<ApiResult<MetricsResponse>> {
|
||||
return apiFetch('GET', `/api/v1/sandboxes/${id}/metrics?range=${range}`);
|
||||
export async function fetchCapsuleMetrics(id: string, range: MetricRange, basePath = '/api/v1/capsules'): Promise<ApiResult<MetricsResponse>> {
|
||||
return apiFetch('GET', `${basePath}/${id}/metrics?range=${range}`);
|
||||
}
|
||||
|
||||
export const METRIC_RANGES: MetricRange[] = ['5m', '10m', '1h', '6h', '24h'];
|
||||
|
||||
// All ranges poll every 10 seconds.
|
||||
// Poll interval varies by range — shorter ranges need fresher data.
|
||||
export const METRIC_POLL_INTERVALS: Record<MetricRange, number> = {
|
||||
'5m': 10_000,
|
||||
'10m': 10_000,
|
||||
'1h': 30_000,
|
||||
'6h': 60_000,
|
||||
'24h': 120_000,
|
||||
};
|
||||
|
||||
/** @deprecated Use METRIC_POLL_INTERVALS instead */
|
||||
export const METRIC_POLL_INTERVAL = 10_000;
|
||||
|
||||
Reference in New Issue
Block a user