diff options
author | Mark Felder <feld@FreeBSD.org> | 2020-10-14 16:06:02 -0500 |
---|---|---|
committer | Mark Felder <feld@FreeBSD.org> | 2020-10-14 16:07:41 -0500 |
commit | 0c7f7bb24df0a9f3603fc2617097f3bbaebaa086 (patch) | |
tree | c03ef56029a234e0523052cf412850dd86ab3444 /lib | |
parent | 20137056900f97af34f4433858cbdf69be6c9840 (diff) | |
download | pleroma-1668/default-disable-prometheus.tar.gz |
Hack to disable Prometheus metrics by default1668/default-disable-prometheus
Diffstat (limited to 'lib')
-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 |