From a2be65aead1191f2045cf530d246360dd5866a5c Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Wed, 27 Sep 2017 21:55:42 -0700 Subject: [PATCH] Reset prometheus summaries for more accurate percentiles per 5 minutes --- src/database.js | 4 ++++ src/web/webserver.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/database.js b/src/database.js index b8512cdb..b3b316b6 100644 --- a/src/database.js +++ b/src/database.js @@ -19,6 +19,10 @@ const queryCount = new Counter({ help: 'DB query count' }); +setInterval(() => { + queryLatency.reset(); +}, 5 * 60 * 1000).unref(); + let db = null; let globalBanDB = null; diff --git a/src/web/webserver.js b/src/web/webserver.js index 25b0af1b..0c14ddbb 100644 --- a/src/web/webserver.js +++ b/src/web/webserver.js @@ -58,6 +58,10 @@ function initPrometheus(app) { }); next(); }); + + setInterval(() => { + latency.reset(); + }, 5 * 60 * 1000).unref(); } /**