summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-04-03 10:20:08 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-04-03 10:20:08 +0000
commit95b3bf26cae3c2e483df4591ec5fe492ab9746a5 (patch)
tree6f1ecb4a252d3c45393e9f57643463279be5efc2 /lib
parent1b6f8cd868ea200e88554ed7cba60a40964493bf (diff)
parent05e1cbc4cae3032eca371e09f35a451628a4e9c6 (diff)
downloadgitlab-ce-95b3bf26cae3c2e483df4591ec5fe492ab9746a5.tar.gz
Merge branch 'sh-move-sidekiq-exporter-logs' into 'master'
Move Sidekiq exporter logs to log/sidekiq_exporter.log See merge request gitlab-org/gitlab-ce!18127
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/metrics/sidekiq_metrics_exporter.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/metrics/sidekiq_metrics_exporter.rb b/lib/gitlab/metrics/sidekiq_metrics_exporter.rb
index db8bdde74b2..47b4af5d649 100644
--- a/lib/gitlab/metrics/sidekiq_metrics_exporter.rb
+++ b/lib/gitlab/metrics/sidekiq_metrics_exporter.rb
@@ -4,6 +4,8 @@ require 'prometheus/client/rack/exporter'
module Gitlab
module Metrics
class SidekiqMetricsExporter < Daemon
+ LOG_FILENAME = File.join(Rails.root, 'log', 'sidekiq_exporter.log')
+
def enabled?
Gitlab::Metrics.metrics_folder_present? && settings.enabled
end
@@ -17,7 +19,13 @@ module Gitlab
attr_reader :server
def start_working
- @server = ::WEBrick::HTTPServer.new(Port: settings.port, BindAddress: settings.address)
+ logger = WEBrick::Log.new(LOG_FILENAME)
+ access_log = [
+ [logger, WEBrick::AccessLog::COMBINED_LOG_FORMAT]
+ ]
+
+ @server = ::WEBrick::HTTPServer.new(Port: settings.port, BindAddress: settings.address,
+ Logger: logger, AccessLog: access_log)
server.mount "/", Rack::Handler::WEBrick, rack_app
server.start
end