feat: add vendor tenant metrics dashboard
Fleet overview page at /vendor/metrics showing per-tenant operational metrics (agents, CPU, heap, HTTP requests, ingestion drops, uptime). Queries each tenant's server via the new POST /api/v1/admin/server-metrics/query REST API instead of direct ClickHouse access, supporting future per-tenant CH instances. Backend: TenantMetricsService fires 11 metric queries per tenant concurrently over a 5-minute window, assembles into a summary snapshot. ServerApiClient.queryServerMetrics() handles the M2M authenticated POST. Frontend: VendorMetricsPage with KPI strip (fleet totals) and per-tenant table with color-coded badges and heap usage bars. Auto-refreshes every 60s. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { api } from './client';
|
||||
import type { VendorTenantSummary, VendorTenantDetail, CreateTenantRequest, TenantResponse, LicenseResponse, AuditLogPage, AuditLogFilters } from '../types/api';
|
||||
import type { VendorTenantSummary, VendorTenantDetail, CreateTenantRequest, TenantResponse, LicenseResponse, AuditLogPage, AuditLogFilters, TenantMetricsEntry } from '../types/api';
|
||||
|
||||
export function useVendorTenants() {
|
||||
return useQuery<VendorTenantSummary[]>({
|
||||
@@ -179,3 +179,13 @@ export function useInfraChDetail(tenantId: string) {
|
||||
enabled: !!tenantId,
|
||||
});
|
||||
}
|
||||
|
||||
// --- Tenant Metrics ---
|
||||
|
||||
export function useTenantMetrics() {
|
||||
return useQuery<TenantMetricsEntry[]>({
|
||||
queryKey: ['vendor', 'metrics'],
|
||||
queryFn: () => api.get('/vendor/metrics'),
|
||||
refetchInterval: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user