mirror of https://github.com/mastodon/mastodon
Start local prometheus_exporter server only in puma/sidekiq startup (#35005)
parent
722fb1ff55
commit
1623d54ec0
@ -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
|
||||||
Loading…
Reference in New Issue