diff options
Diffstat (limited to 'lib/pleroma')
-rw-r--r-- | lib/pleroma/application.ex | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 301b4e273..92096e112 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -135,23 +135,25 @@ defmodule Pleroma.Application do end defp setup_instrumenters do - require Prometheus.Registry - - if Application.get_env(:prometheus, Pleroma.Repo.Instrumenter) do - :ok = - :telemetry.attach( - "prometheus-ecto", - [:pleroma, :repo, :query], - &Pleroma.Repo.Instrumenter.handle_event/4, - %{} - ) - - Pleroma.Repo.Instrumenter.setup() - end + if Application.get_env(:prometheus, Pleroma.Web.Endpoint.MetricsExporter)[:enabled] do + require Prometheus.Registry + + if Application.get_env(:prometheus, Pleroma.Repo.Instrumenter) do + :ok = + :telemetry.attach( + "prometheus-ecto", + [:pleroma, :repo, :query], + &Pleroma.Repo.Instrumenter.handle_event/4, + %{} + ) + + Pleroma.Repo.Instrumenter.setup() + end - Pleroma.Web.Endpoint.MetricsExporter.setup() - Pleroma.Web.Endpoint.PipelineInstrumenter.setup() - Pleroma.Web.Endpoint.Instrumenter.setup() + Pleroma.Web.Endpoint.MetricsExporter.setup() + Pleroma.Web.Endpoint.PipelineInstrumenter.setup() + Pleroma.Web.Endpoint.Instrumenter.setup() + end end defp cachex_children do |