2024-06-10 13:08:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-03-15 18:31:06 -04:00
|
|
|
Sidekiq.configure_server do |config|
|
|
|
|
|
config.redis = { url: ENV['REDIS_URL'] }
|
2024-11-20 06:02:31 -05:00
|
|
|
|
2024-11-20 15:07:43 -05:00
|
|
|
if ENV['PROMETHEUS_EXPORTER_ENABLED'].to_s == 'true'
|
2024-11-20 16:00:24 -05:00
|
|
|
require 'prometheus_exporter/instrumentation'
|
|
|
|
|
|
2024-12-04 09:00:28 -05:00
|
|
|
# Add middleware for collecting job-level metrics
|
2024-11-20 15:07:43 -05:00
|
|
|
config.server_middleware do |chain|
|
|
|
|
|
chain.add PrometheusExporter::Instrumentation::Sidekiq
|
|
|
|
|
end
|
2024-11-20 14:50:21 -05:00
|
|
|
|
2024-12-04 09:00:28 -05:00
|
|
|
# Capture metrics for failed jobs
|
2024-11-20 15:07:43 -05:00
|
|
|
config.death_handlers << PrometheusExporter::Instrumentation::Sidekiq.death_handler
|
2024-11-20 14:50:21 -05:00
|
|
|
|
2024-12-04 09:00:28 -05:00
|
|
|
# Start Prometheus instrumentation
|
2024-11-20 15:07:43 -05:00
|
|
|
config.on :startup do
|
|
|
|
|
PrometheusExporter::Instrumentation::SidekiqProcess.start
|
|
|
|
|
PrometheusExporter::Instrumentation::SidekiqQueue.start
|
|
|
|
|
PrometheusExporter::Instrumentation::SidekiqStats.start
|
|
|
|
|
end
|
2024-11-20 14:50:21 -05:00
|
|
|
end
|
2024-03-15 18:31:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Sidekiq.configure_client do |config|
|
|
|
|
|
config.redis = { url: ENV['REDIS_URL'] }
|
|
|
|
|
end
|
2024-11-24 09:28:09 -05:00
|
|
|
|
2024-12-04 09:00:28 -05:00
|
|
|
Sidekiq::Queue['reverse_geocoding'].limit = 1 if Sidekiq.server? && PHOTON_API_HOST == 'photon.komoot.io'
|