diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /metrics_server/metrics_server.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'metrics_server/metrics_server.rb')
-rw-r--r-- | metrics_server/metrics_server.rb | 10 |
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 |