Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'metrics_server/metrics_server.rb')
-rw-r--r--metrics_server/metrics_server.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/metrics_server/metrics_server.rb b/metrics_server/metrics_server.rb
index 56fc20dcc9d..122a4e4fc1e 100644
--- a/metrics_server/metrics_server.rb
+++ b/metrics_server/metrics_server.rb
@@ -40,15 +40,21 @@ class MetricsServer # rubocop:disable Gitlab/NamespacedClass
def start
::Prometheus::Client.configure do |config|
config.multiprocess_files_dir = @metrics_dir
+ config.pid_provider = proc { "#{@target}_exporter" }
end
FileUtils.mkdir_p(@metrics_dir, mode: 0700)
::Prometheus::CleanupMultiprocDirService.new.execute if @wipe_metrics_dir
- settings = Settings.new(Settings.monitoring[name])
+ # We need to `warmup: true` since otherwise the sampler and exporter threads enter
+ # a race where not all Prometheus db files will be visible to the exporter, resulting
+ # in missing metrics.
+ # Warming up ensures that these files exist prior to the exporter starting up.
+ Gitlab::Metrics::Samplers::RubySampler.initialize_instance(warmup: true).start
exporter_class = "Gitlab::Metrics::Exporter::#{@target.camelize}Exporter".constantize
- server = exporter_class.instance(settings, synchronous: true)
+ settings = Settings.new(Settings.monitoring[name])
+ server = exporter_class.instance(settings, gc_requests: true, synchronous: true)
server.start
end