From a058a4159596eaee3ef6529103f72fd4995490c7 Mon Sep 17 00:00:00 2001 From: Anbang Wen Date: Tue, 10 Jul 2018 01:02:59 -0700 Subject: [PATCH] http: run prometheus metrics collector on leader only Metrics are collected and merged in http.prometheus, no need to be run on every worker. --- modules/http/http.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/http/http.lua b/modules/http/http.lua index e4baf8fdd..a81935997 100644 --- a/modules/http/http.lua +++ b/modules/http/http.lua @@ -366,7 +366,10 @@ end -- @function Init module function M.init() - worker.coroutine(prometheus.init) + -- collect and merge metrics only on leader + if worker.id == 0 then + worker.coroutine(prometheus.init) + end end -- @function Cleanup module -- 2.47.3