mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
Start local prometheus_exporter server only in puma/sidekiq startup (#35005)
This commit is contained in:
18
lib/mastodon/prometheus_exporter/local_server.rb
Normal file
18
lib/mastodon/prometheus_exporter/local_server.rb
Normal file
@@ -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