]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
http: run prometheus metrics collector on leader only
authorAnbang Wen <anbang@cloudflare.com>
Tue, 10 Jul 2018 08:02:59 +0000 (01:02 -0700)
committerMarek Vavruša <mvavrusa@cloudflare.com>
Fri, 7 Sep 2018 17:45:21 +0000 (10:45 -0700)
Metrics are collected and merged in http.prometheus, no need to be run
on every worker.

modules/http/http.lua

index e4baf8fdde5cfd38aa114a5afd5723eefebd5074..a81935997ce828711d8abf4398fd3475e85ef824 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