feat(ops): add usage_logs partition status to ops dashboard
Add partition management integration to the smart ops system: - Backend: Add GetUsageLogsPartitionStatus endpoint in OpsHandler - Backend: Add partition query methods in OpsRepository - Backend: Add UsageLogsPartitionStatus type in OpsService - Frontend: Add OpsPartitionStatusCard component - Frontend: Add partition status display in OpsDashboard - i18n: Add Chinese and English translations The partition status card shows: - Whether usage_logs is partitioned - Current row count vs threshold (100K) - Partition count (if partitioned) - Warning message when partitioning is recommended This allows administrators to monitor partition status directly from the ops dashboard without checking server logs.
This commit is contained in:
@@ -950,6 +950,23 @@ export interface OpsSystemLogSinkHealth {
|
||||
last_error?: string
|
||||
}
|
||||
|
||||
// ==================== Usage Logs Partition Management ====================
|
||||
|
||||
export interface UsageLogsPartitionStatus {
|
||||
is_partitioned: boolean
|
||||
row_count: number
|
||||
partition_count: number
|
||||
threshold_rows: number
|
||||
needs_partitioning: boolean
|
||||
warning_level: 'none' | 'info' | 'warning'
|
||||
last_checked_at: string
|
||||
}
|
||||
|
||||
export async function getUsageLogsPartitionStatus(): Promise<UsageLogsPartitionStatus> {
|
||||
const { data } = await apiClient.get<UsageLogsPartitionStatus>('/admin/ops/partition-status')
|
||||
return data
|
||||
}
|
||||
|
||||
export interface OpsErrorLog {
|
||||
id: number
|
||||
created_at: string
|
||||
@@ -1450,7 +1467,10 @@ export const opsAPI = {
|
||||
updateMetricThresholds,
|
||||
listSystemLogs,
|
||||
cleanupSystemLogs,
|
||||
getSystemLogSinkHealth
|
||||
getSystemLogSinkHealth,
|
||||
|
||||
// Usage logs partition management
|
||||
getUsageLogsPartitionStatus
|
||||
}
|
||||
|
||||
export default opsAPI
|
||||
|
||||
Reference in New Issue
Block a user