Class: GitLab::Exporter::WebExporter
- Inherits:
-
Object
- Object
- GitLab::Exporter::WebExporter
- Extended by:
- TLSHelper
- Defined in:
- lib/gitlab_exporter/web_exporter.rb
Overview
Metrics web exporter backed directly by WEBrick (no Sinatra/Rack).
Constant Summary collapse
- DEFAULT_WEB_SERVER =
"webrick".freeze
- DEFAULT_LISTEN_ADDRESS =
"0.0.0.0".freeze
- DEFAULT_LISTEN_PORT =
9168- DEFAULT_MEMORY_THRESHOLD =
1024- SECURITY_HEADERS =
Security response headers previously added by Sinatra's Rack::Protection middleware, which is gone now that we serve directly via WEBrick. Kept for parity so scanners and consumers see the same headers as before.
{ "X-Content-Type-Options" => "nosniff", "X-Frame-Options" => "SAMEORIGIN", "X-XSS-Protection" => "1; mode=block" }.freeze
Constants included from TLSHelper
Class Method Summary collapse
Methods included from TLSHelper
load_ca_certs_bundle, validate_tls_config, webrick_tls_config
Class Method Details
.run! ⇒ Object
42 43 44 45 |
# File 'lib/gitlab_exporter/web_exporter.rb', line 42 def run! trap_signals @server.start end |
.setup(config) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/gitlab_exporter/web_exporter.rb', line 29 def setup(config) server_config = config[:server] || {} memory_threshold = server_config.fetch(:memory_threshold, DEFAULT_MEMORY_THRESHOLD) @memory_threshold = memory_threshold.to_i * 1024 @server = build_server(server_config) mount_probes(config[:probes]) # Defrag heap after everything is loaded into memory. GC.compact end |