Commit 38f8aedd authored by David Wilkins's avatar David Wilkins Committed by Kamil Trzciński

Do not clean the prometheus metrics directory for sidekiq

- `sidekiq-cluster` starts multiple processes.  Cleaning the metrics
  directory by every process can cause the exporter to miss
  metrics for some processes.
parent dc144187
---
title: Do not clean the prometheus metrics directory for sidekiq
merge_request: 21671
author:
type: fixed
...@@ -32,15 +32,8 @@ end ...@@ -32,15 +32,8 @@ end
Sidekiq.configure_server do |config| Sidekiq.configure_server do |config|
config.on(:startup) do config.on(:startup) do
# webserver metrics are cleaned up in config.ru: `warmup` block # Do not clean the metrics directory here - the supervisor script should
Prometheus::CleanupMultiprocDirService.new.execute # have already taken care of that
# In production, sidekiq is run in a multi-process setup where processes might interfere
# with each other cleaning up and reinitializing prometheus database files, which is why
# we're re-doing the work every time here.
# A cleaner solution would be to run the cleanup pre-fork, and the initialization once
# after all workers have forked, but I don't know how at this point.
::Prometheus::Client.reinitialize_on_pid_change(force: true)
Gitlab::Metrics::Exporter::SidekiqExporter.instance.start Gitlab::Metrics::Exporter::SidekiqExporter.instance.start
end end
end end
......
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