From: Anbang Wen Date: Tue, 10 Jul 2018 08:02:59 +0000 (-0700) Subject: modules/http: run prometheus collector on leader only X-Git-Tag: v3.2.0~35^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72e0a76b69dc99196cd98a4cf40c954c5c5a4c01;p=thirdparty%2Fknot-resolver.git modules/http: run prometheus collector on leader only Metrics are collected and merged in http.prometheus, no need to be run on every worker. --- diff --git a/NEWS b/NEWS index 0a2e8de5f..5a8dc6b2c 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,11 @@ Module API changes - kr_request::qsource.tcp renamed to ::qsource.flags.tcp - kr_request::has_tls renamed to ::qsource.flags.tls +Bugfixes +-------- +- http module: only run prometheus in parent process if using --forks=N, + as the submodule collects metrics from all sub-processes as well. + Knot Resolver 3.1.0 (2018-11-02) ================================ diff --git a/modules/http/http.lua b/modules/http/http.lua index dabdeba1c..00d4a00e1 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