Start local prometheus_exporter server only in puma/sidekiq startup (#35005)
This commit is contained in:
1 parent
722fb1ff55
commit
1623d54ec0
4 files changed
+33
-7
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'prometheus_exporter/server'
|
||||
require 'prometheus_exporter/client'
|
||||
|
||||
module Mastodon::PrometheusExporter
|
||||
module LocalServer
|
||||
mattr_accessor :bind, :port
|
||||
|
||||
def self.setup!
|
||||
server = PrometheusExporter::Server::WebServer.new(bind:, port:)
|
||||
server.start
|
||||
|
||||
# wire up a default local client
|
||||
PrometheusExporter::Client.default = PrometheusExporter::LocalClient.new(collector: server.collector)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user