Skip to content

Commit

Permalink
add sinatra
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericfran-gds committed Aug 4, 2022
1 parent 41ff5ec commit 4a03ddb
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions lib/govuk_app_config/govuk_prometheus_exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,29 @@ def self.configure
require "prometheus_exporter/server"
require "prometheus_exporter/middleware"

#if defined?(Sidekiq)
Sidekiq.configure_server do |config|
require "prometheus_exporter/instrumentation"
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
if defined?(Sidekiq)
Sidekiq.configure_server do |config|
require "prometheus_exporter/instrumentation"
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

server = PrometheusExporter::Server::WebServer.new bind: "0.0.0.0", port: 9394
server.start

if defined?(Rails)
Rails.application.middleware.unshift PrometheusExporter::Middleware
else defined?(Sinatra)
Sinatra.application.middleware.unshift PrometheusExporter::Middleware
end
end
end
Expand Down

0 comments on commit 4a03ddb

Please sign in to comment.