2022-12-15 02:02:07 +00:00
|
|
|
defmodule Pleroma.Web.AkkomaAPI.MetricsController do
|
|
|
|
use Pleroma.Web, :controller
|
|
|
|
|
|
|
|
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
|
|
|
|
2022-12-16 03:32:51 +00:00
|
|
|
plug(
|
|
|
|
OAuthScopesPlug,
|
|
|
|
%{scopes: ["admin:metrics"]}
|
|
|
|
when action in [
|
|
|
|
:show
|
|
|
|
]
|
|
|
|
)
|
2022-12-15 02:02:07 +00:00
|
|
|
|
|
|
|
def show(conn, _params) do
|
|
|
|
stats = TelemetryMetricsPrometheus.Core.scrape()
|
|
|
|
|
|
|
|
conn
|
|
|
|
|> text(stats)
|
|
|
|
end
|
|
|
|
end
|