feat: add configurable infrastructure alerts
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { request, withQuery } from '../core/httpClient';
|
||||
import type { InfrastructureMonitoringOverview, InfrastructureMonitoringRange } from '../types';
|
||||
import type { InfrastructureAlertSettings, InfrastructureAlertThresholds, InfrastructureMonitoringOverview, InfrastructureMonitoringRange } from '../types';
|
||||
|
||||
export const adminInfrastructureMonitoringApi = {
|
||||
getInfrastructureMonitoringOverview: (range: InfrastructureMonitoringRange) =>
|
||||
request<InfrastructureMonitoringOverview>(withQuery('/admin/infrastructure-monitoring/overview', { range })),
|
||||
getInfrastructureMonitoringNotificationSummary: () => request<{ count: number; criticalCount: number }>('/admin/infrastructure-monitoring/notification-summary'),
|
||||
getInfrastructureAlertThresholds: () => request<InfrastructureAlertSettings>('/admin/infrastructure-monitoring/alert-thresholds'),
|
||||
updateInfrastructureAlertThresholds: (body: { configVersion: number; thresholds: InfrastructureAlertThresholds }) => request<InfrastructureAlertSettings>('/admin/infrastructure-monitoring/alert-thresholds', { method: 'PUT', body: JSON.stringify(body) }),
|
||||
};
|
||||
|
||||
@@ -76,3 +76,16 @@ export type InfrastructureMonitoringOverview = {
|
||||
serviceMetrics: InfrastructureServiceMetricGroup[];
|
||||
alerts: InfrastructureAlert[];
|
||||
};
|
||||
|
||||
export type InfrastructureAlertThresholds = Record<string, { warning: number; critical: number }>;
|
||||
|
||||
export type InfrastructureAlertSettings = {
|
||||
configVersion: number;
|
||||
effectiveVersion: number;
|
||||
applyStatus: 'effective' | 'applying' | 'failed';
|
||||
lastError: string | null;
|
||||
appliedAt: string | null;
|
||||
thresholds: InfrastructureAlertThresholds;
|
||||
effectiveThresholds: InfrastructureAlertThresholds;
|
||||
definitions: Array<{ key: string; label: string; unit: string; min: number; max: number; step: number }>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user