1
0
Fork 0
forked from gitea/nas

Start local prometheus_exporter server only in puma/sidekiq startup (#35005)

This commit is contained in:
David Roetzel 2025-06-11 15:37:59 +02:00 committed by GitHub
parent 722fb1ff55
commit 1623d54ec0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 7 deletions

View 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