lib/syslogstash/prometheus_exporter.rb in syslogstash-0.4.1 vs lib/syslogstash/prometheus_exporter.rb in syslogstash-1.0.0

- old
+ new

@@ -1,8 +1,9 @@ require 'prometheus/client/rack/exporter' require 'rack' -require 'rack/handler/puma' +require 'rack/handler/webrick' +require 'logger' class Syslogstash::PrometheusExporter attr_reader :thread def initialize @@ -38,10 +39,14 @@ @thread = Thread.new do app = Rack::Builder.new app.use Prometheus::Client::Rack::Exporter app.run ->(env) { [404, {'Content-Type' => 'text/plain'}, ['Nope']] } - Rack::Handler::Puma.run app, Host: '[::]', Port: 9159 + logger = Logger.new($stderr) + logger.level = Logger::INFO + logger.formatter = proc { |s, t, p, m| "[Syslogstash::PrometheusExporter::WEBrick] #{m}\n" } + + Rack::Handler::WEBrick.run app, BindAddress: '::', Port: 9159, Logger: logger, AccessLog: [] end end private