Update sidekiq configuration to include Prometheus instrumentation

This commit is contained in:
Eugene Burmakin 2024-11-20 20:50:21 +01:00
parent d0e0158ef9
commit 55a575f87a

View file

@ -3,10 +3,22 @@
Sidekiq.configure_server do |config|
config.redis = { url: ENV['REDIS_URL'] }
config.server_middleware do |chain|
if ENV.fetch('PROMETHEUS_EXPORTER_ENABLED', false)
require 'prometheus_exporter/instrumentation'
chain.add PrometheusExporter::Instrumentation::Sidekiq
end
config.server_middleware do |chain|
chain.add PrometheusExporter::Instrumentation::Sidekiq
end
config.death_handlers << PrometheusExporter::Instrumentation::Sidekiq.death_handler
config.on :startup do
PrometheusExporter::Instrumentation::Process.start type: 'sidekiq'
PrometheusExporter::Instrumentation::SidekiqProcess.start
PrometheusExporter::Instrumentation::SidekiqQueue.start
PrometheusExporter::Instrumentation::SidekiqStats.start
end
end
end
Sidekiq.configure_client do |config|