2024-06-10 13:08:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2025-06-09 07:39:25 -04:00
|
|
|
Sidekiq.configure_server do |config|
|
2025-11-24 13:45:09 -05:00
|
|
|
config.redis = { url: ENV['REDIS_URL'], db: ENV.fetch('RAILS_JOB_QUEUE_DB', 1) }
|
2025-06-09 07:39:25 -04:00
|
|
|
config.logger = Sidekiq::Logger.new($stdout)
|
2024-11-20 06:02:31 -05:00
|
|
|
|
2025-06-09 07:39:25 -04:00
|
|
|
if ENV['PROMETHEUS_EXPORTER_ENABLED'].to_s == 'true'
|
|
|
|
|
require 'prometheus_exporter/instrumentation'
|
|
|
|
|
# Add middleware for collecting job-level metrics
|
|
|
|
|
config.server_middleware do |chain|
|
|
|
|
|
chain.add PrometheusExporter::Instrumentation::Sidekiq
|
|
|
|
|
end
|
2024-11-20 16:00:24 -05:00
|
|
|
|
2025-06-09 07:39:25 -04:00
|
|
|
# Capture metrics for failed jobs
|
|
|
|
|
config.death_handlers << PrometheusExporter::Instrumentation::Sidekiq.death_handler
|
2024-11-20 14:50:21 -05:00
|
|
|
|
2025-06-09 07:39:25 -04:00
|
|
|
# Start Prometheus instrumentation
|
|
|
|
|
config.on :startup do
|
|
|
|
|
PrometheusExporter::Instrumentation::SidekiqProcess.start
|
|
|
|
|
PrometheusExporter::Instrumentation::SidekiqQueue.start
|
|
|
|
|
PrometheusExporter::Instrumentation::SidekiqStats.start
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2024-11-20 14:50:21 -05:00
|
|
|
|
2025-06-09 07:39:25 -04:00
|
|
|
Sidekiq.configure_client do |config|
|
2025-12-14 06:05:59 -05:00
|
|
|
config.redis = { url: ENV['REDIS_URL'], db: ENV.fetch('RAILS_JOB_QUEUE_DB', 1) }
|
2025-06-09 07:39:25 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Sidekiq::Queue['reverse_geocoding'].limit = 1 if Sidekiq.server? && DawarichSettings.photon_uses_komoot_io?
|