(POOLER-160) Revise some smelly logger code

Need the logger code in promstats.rb so move logger initialisation to
the top of the vmpooler script, remove the class method from vmpooler.rb
and make appropriate downstream changes to metrics and pooler manger
handling.

This also means we can start decent logging in the API if we wish do.

Fixed up to rebase on top of Matts POOLER-158 changes
This commit is contained in:
John O'Connor 2020-05-22 17:07:33 +01:00
parent bbd76bde4c
commit 5c38ba240a
6 changed files with 17 additions and 26 deletions

View file

@ -3,13 +3,13 @@
module Vmpooler
class Metrics
# static class instantiate appropriate metrics object.
def self.init(params)
def self.init(logger, params)
if params[:statsd]
metrics = Vmpooler::Statsd.new(params[:statsd])
metrics = Vmpooler::Statsd.new(logger, params[:statsd])
elsif params[:graphite]
metrics = Vmpooler::Graphite.new(params[:graphite])
metrics = Vmpooler::Graphite.new(logger, params[:graphite])
elsif params[:prometheus]
metrics = Vmpooler::Promstats.new(params[:prometheus])
metrics = Vmpooler::Promstats.new(logger, params[:prometheus])
else
metrics = Vmpooler::DummyStatsd.new
end