Commit 34289924 authored by Pablo Carranza's avatar Pablo Carranza
Browse files

Merge branch 'fix/server-bind-address' into 'master'

Bind server to 0.0.0.0 address



See merge request !11
parents 9ffe258d 2776b867
PATH
remote: .
specs:
gitlab-monitor (0.0.3)
gitlab-monitor (0.0.4)
pg (~> 0.18.4)
sinatra (~> 1.4.7)
......
server:
listen_address: 0.0.0.0
listen_port: 4567
probes:
dead_tuples_count:
class_name: Database::DeadTuplesProber
......
module GitLab
module Monitor
VERSION = "0.0.3".freeze
VERSION = "0.0.4".freeze
end
end
......@@ -5,8 +5,20 @@ module GitLab
# Metrics web exporter
class WebExporter < Sinatra::Base
class << self
def setup(config) # rubocop:disable Metrics/AbcSize
config[:probes].each do |probe_name, params|
def setup(config)
setup_server(config[:server])
setup_probes(config[:probes])
end
def setup_server(config)
config ||= {}
set(:bind, config.fetch(:listen_address, "0.0.0.0"))
set(:port, config.fetch(:listen_port, 4567))
end
def setup_probes(config) # rubocop:disable Metrics/AbcSize
(config || {}).each do |probe_name, params|
prober_class_name = params.delete(:class_name) || Utils.camel_case_string("#{probe_name}_prober")
prober_class = resolve_prober_class(prober_class_name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment