From c43f97e8e3c60b54cc21934c963f5f77e4535d70 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 24 May 2017 11:47:06 +0100 Subject: [PATCH] add metric for active workers --- services/document-updater/app/coffee/DispatchManager.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/document-updater/app/coffee/DispatchManager.coffee b/services/document-updater/app/coffee/DispatchManager.coffee index b7e50291b0..4444c0183b 100644 --- a/services/document-updater/app/coffee/DispatchManager.coffee +++ b/services/document-updater/app/coffee/DispatchManager.coffee @@ -20,7 +20,9 @@ module.exports = DispatchManager = [list_name, doc_key] = result [project_id, doc_id] = Keys.splitProjectIdAndDocId(doc_key) # Dispatch this in the background + Metrics.gauge "processingUpdates", "+1" # increments/decrements gauge with +/- sign UpdateManager.processOutstandingUpdatesWithLock project_id, doc_id, (error) -> + Metrics.gauge "processingUpdates", "-1" logger.error err: error, project_id: project_id, doc_id: doc_id, "error processing update" if error? callback() @@ -39,4 +41,4 @@ module.exports = DispatchManager = createAndStartDispatchers: (number) -> for i in [1..number] worker = DispatchManager.createDispatcher() - worker.run() \ No newline at end of file + worker.run()