prometheus#proxy_prefix for simplification of PrefixProxy.new. missing @verify for Postfix added.

This commit is contained in:
Denis Knauf 2022-10-04 18:21:26 +02:00
parent 24858883b4
commit 01677886a2
2 changed files with 20 additions and 12 deletions

View file

@ -54,8 +54,8 @@ class Collector::Postfix
class Postscreen
def initialize store, prometheus
@store = store
@noqueue = Noqueue.new store, Collector::PrefixProxy.new( prometheus, :noqueue)
@cache = Cache.new store, Collector::PrefixProxy.new( prometheus, :cache)
@noqueue = Noqueue.new store, prometheus.prefix_proxy( :noqueue)
@cache = Cache.new store, prometheus.prefix_proxy( :cache)
@connect_from = prometheus.counter :connect_from_total, docstring: 'A counter of connections to postscreen'
@whitelisted = prometheus.counter :whitelisted_total, docstring: 'A counter of WHITELISTED connections to postscreen'
@pass_old = prometheus.counter :pass_old_total, docstring: 'A counter of PASS OLD connections to postscreen'
@ -181,7 +181,7 @@ class Collector::Postfix
class Smtpd
def initialize store, prometheus
@store = store
@noqueue = Noqueue.new store, Collector::PrefixProxy.new( prometheus, :noqueue)
@noqueue = Noqueue.new store, prometheus.prefix_proxy( :noqueue)
@connect_from = prometheus.counter :connect_from_total, docstring: 'A counter of connections to smtpd', labels: %i[from_unknown]
%w[0 1].each {|x| @connect_from.increment by: 0, labels: {from_unknown: x} }
@tls = prometheus.counter :tls_total, docstring: 'A counter of TLS connections to smtpd with TLS-version and cipher', labels: %i[trust tls cipher]
@ -330,7 +330,7 @@ class Collector::Postfix
class Verify
def initialize store, prometheus
@store = store
@cache = Cache.new store, Collector::PrefixProxy.new( prometheus, :cache)
@cache = Cache.new store, prometheus.prefix_proxy( :cache)
end
def collect entry
@ -344,13 +344,14 @@ class Collector::Postfix
def initialize store, prometheus
@store = store
@postscreen = Postscreen.new store, Collector::PrefixProxy.new( prometheus, :postscreen)
@smtp = Smtp.new store, Collector::PrefixProxy.new( prometheus, :smtp)
@smtpd = Smtpd.new store, Collector::PrefixProxy.new( prometheus, :smtpd)
@submission = Smtpd.new store, Collector::PrefixProxy.new( prometheus, :submission)
@tlsproxy = Tlsproxy.new store, Collector::PrefixProxy.new( prometheus, :tlsproxy)
@scache = SCache.new store, Collector::PrefixProxy.new( prometheus, :scache)
@bounce = Bounce.new store, Collector::PrefixProxy.new( prometheus, :bounce)
@postscreen = Postscreen.new store, prometheus.prefix_proxy( :postscreen)
@smtp = Smtp.new store, prometheus.prefix_proxy( :smtp)
@smtpd = Smtpd.new store, prometheus.prefix_proxy( :smtpd)
@submission = Smtpd.new store, prometheus.prefix_proxy( :submission)
@tlsproxy = Tlsproxy.new store, prometheus.prefix_proxy( :tlsproxy)
@scache = SCache.new store, prometheus.prefix_proxy( :scache)
@bounce = Bounce.new store, prometheus.prefix_proxy( :bounce)
@verify = Verify.new store, prometheus.prefix_proxy( :verify)
@qmgr = prometheus.counter :qmgr_total, docstring: 'A counter of qmgr actions'
@cleanup = prometheus.counter :cleanup_total, docstring: 'A counter of cleanup actions'
@lmtp = prometheus.counter :lmtp_total, docstring: 'A counter of ltmp actions'