-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |