]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/http: run prometheus collector on leader only
authorAnbang Wen <anbang@cloudflare.com>
Tue, 10 Jul 2018 08:02:59 +0000 (01:02 -0700)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 14 Nov 2018 10:21:53 +0000 (11:21 +0100)
Metrics are collected and merged in http.prometheus, no need to be run
on every worker.

NEWS
modules/http/http.lua

diff --git a/NEWS b/NEWS
index 0a2e8de5faee6f702fca12dae582cf7542675bba..5a8dc6b2c0a94af6ad48a4a1fdaba593dc9f684a 100644 (file)
--- 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)
 ================================
index dabdeba1c9d2acc02fb9766d892bf3d3be7f1bd1..00d4a00e15c15dd4af3e96079637a5816300e9b4 100644 (file)
@@ -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