diff --git a/server/src/controllers/analytics_controller.ts b/server/src/controllers/analytics_controller.ts index 7627820..2eec296 100644 --- a/server/src/controllers/analytics_controller.ts +++ b/server/src/controllers/analytics_controller.ts @@ -28,6 +28,8 @@ let alertService: AlertService = undefined; let grafanaAvailableWebhok: Function = undefined; let dataPuller: DataPuller; +let detectionsCount: number = 0; + function onTaskResult(taskResult: TaskResult) { let id = taskResult._id; @@ -47,6 +49,7 @@ function onTaskResult(taskResult: TaskResult) { } async function onDetect(detectionResult: DetectionResult) { + detectionsCount++; let id = detectionResult.analyticUnitId; let payload = await processDetectionResult(id, detectionResult); await Promise.all([ @@ -365,6 +368,10 @@ export function getTaskResolversLength(): number { return taskResolvers.size; } +export function getDetectionsCount(): number { + return detectionsCount; +} + export function isAnalyticReady(): boolean { return analyticsService.ready; } diff --git a/server/src/index.ts b/server/src/index.ts index 96df9ff..873ac23 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -67,6 +67,7 @@ async function init() { tasksQueueLength: AnalyticsController.getQueueLength() }, awaitedTasksNumber: AnalyticsController.getTaskResolversLength(), + detectionsCount: AnalyticsController.getDetectionsCount(), nodeVersion: process.version, packageVersion: PACKAGE_VERSION, npmUserAgent: process.env.npm_config_user_agent,