Start local prometheus_exporter server only in puma/sidekiq startup (#35005)
This commit is contained in:
@@ -5,16 +5,12 @@ if ENV['MASTODON_PROMETHEUS_EXPORTER_ENABLED'] == 'true'
|
||||
require 'prometheus_exporter/middleware'
|
||||
|
||||
if ENV['MASTODON_PROMETHEUS_EXPORTER_LOCAL'] == 'true'
|
||||
require 'prometheus_exporter/server'
|
||||
require 'prometheus_exporter/client'
|
||||
require 'mastodon/prometheus_exporter/local_server'
|
||||
|
||||
# bind is the address, on which the webserver will listen
|
||||
# port is the port that will provide the /metrics route
|
||||
server = PrometheusExporter::Server::WebServer.new bind: ENV.fetch('MASTODON_PROMETHEUS_EXPORTER_HOST', 'localhost'), port: ENV.fetch('MASTODON_PROMETHEUS_EXPORTER_PORT', '9394').to_i
|
||||
server.start
|
||||
|
||||
# wire up a default local client
|
||||
PrometheusExporter::Client.default = PrometheusExporter::LocalClient.new(collector: server.collector)
|
||||
Mastodon::PrometheusExporter::LocalServer.bind = ENV.fetch('MASTODON_PROMETHEUS_EXPORTER_HOST', 'localhost')
|
||||
Mastodon::PrometheusExporter::LocalServer.port = ENV.fetch('MASTODON_PROMETHEUS_EXPORTER_PORT', '9394').to_i
|
||||
end
|
||||
|
||||
if ENV['MASTODON_PROMETHEUS_EXPORTER_WEB_DETAILED_METRICS'] == 'true'
|
||||
|
||||
Reference in New Issue
Block a user