mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-10-31 05:51:16 +00:00
25 lines
506 B
Elixir
25 lines
506 B
Elixir
defmodule Pleroma.Web.AkkomaAPI.MetricsController do
|
|
use Pleroma.Web, :controller
|
|
|
|
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
|
alias Pleroma.Config
|
|
|
|
plug(
|
|
OAuthScopesPlug,
|
|
%{scopes: ["admin:metrics"]}
|
|
when action in [
|
|
:show
|
|
]
|
|
)
|
|
|
|
def show(conn, _params) do
|
|
if Config.get([:instance, :export_prometheus_metrics], true) do
|
|
conn
|
|
|> text(TelemetryMetricsPrometheus.Core.scrape())
|
|
else
|
|
conn
|
|
|> send_resp(404, "Not Found")
|
|
end
|
|
end
|
|
end
|