feat(telemetry): add comprehensive Prometheus metrics and expand dashboard with system, API, ML, and Node.js runtime sections
This commit is contained in:
@@ -44,6 +44,14 @@ export const diagnosisCounter = new Counter({
|
||||
registers: [registry],
|
||||
});
|
||||
|
||||
export const diagnosisUploadSize = new Histogram({
|
||||
name: 'zeavis_api_diagnosis_upload_bytes',
|
||||
help: 'Distribution of uploaded diagnosis image sizes in bytes',
|
||||
labelNames: ['status'] as const,
|
||||
buckets: [1024, 51200, 102400, 204800, 512000, 1048576, 2097152, 5242880],
|
||||
registers: [registry],
|
||||
});
|
||||
|
||||
export const authCounter = new Counter({
|
||||
name: 'zeavis_api_auth_operations_total',
|
||||
help: 'Total authentication operations (login, register, refresh)',
|
||||
@@ -51,6 +59,43 @@ export const authCounter = new Counter({
|
||||
registers: [registry],
|
||||
});
|
||||
|
||||
export const diseaseCatalogRequests = new Counter({
|
||||
name: 'zeavis_api_disease_catalog_requests_total',
|
||||
help: 'Total disease catalog page views',
|
||||
labelNames: ['type'] as const, // 'list' | 'detail'
|
||||
registers: [registry],
|
||||
});
|
||||
|
||||
export const expertReviewCounter = new Counter({
|
||||
name: 'zeavis_api_expert_reviews_total',
|
||||
help: 'Total expert reviews submitted',
|
||||
labelNames: ['verdict'] as const, // 'verified' | 'corrected'
|
||||
registers: [registry],
|
||||
});
|
||||
|
||||
export const dbQueryDuration = new Histogram({
|
||||
name: 'zeavis_api_db_query_duration_seconds',
|
||||
help: 'Histogram of database query durations',
|
||||
labelNames: ['operation'] as const,
|
||||
buckets: [0.001, 0.005, 0.01, 0.05, 0.1, 0.25, 0.5, 1],
|
||||
registers: [registry],
|
||||
});
|
||||
|
||||
export const imageModelInferenceDuration = new Histogram({
|
||||
name: 'zeavis_api_ml_inference_duration_seconds',
|
||||
help: 'Histogram of ML model inference durations (via API->ML service)',
|
||||
labelNames: ['result'] as const, // 'success' | 'failure'
|
||||
buckets: [0.05, 0.1, 0.25, 0.5, 0.75, 1, 2, 5, 10],
|
||||
registers: [registry],
|
||||
});
|
||||
|
||||
export const mlServiceRequests = new Counter({
|
||||
name: 'zeavis_api_ml_service_requests_total',
|
||||
help: 'Total requests forwarded to ML service',
|
||||
labelNames: ['status'] as const, // 'success' | 'error'
|
||||
registers: [registry],
|
||||
});
|
||||
|
||||
// ── Export ──────────────────────────────────────────────
|
||||
|
||||
export function getMetricsContentType(): string {
|
||||
|
||||
Reference in New Issue
Block a user