Skip to content

Commit

Permalink
Use custom config
Browse files Browse the repository at this point in the history
  • Loading branch information
vertism committed Oct 10, 2024
1 parent f6ce880 commit 6f053b6
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions config/initializers/prometheus_exporter.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
require "govuk_app_config/govuk_prometheus_exporter"
GovukPrometheusExporter.configure
unless Rails.env.test? || Rails.env.development?
require "prometheus_exporter/middleware"
require "prometheus_exporter/instrumentation"

# This reports stats per request like HTTP status and timings
Rails.application.middleware.unshift PrometheusExporter::Middleware
# this reports basic process stats like RSS and GC info
PrometheusExporter::Instrumentation::Process.start(type: "master")

if defined?(Sidekiq)
Sidekiq.configure_server do |config|
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
end

0 comments on commit 6f053b6

Please sign in to comment.