Measure stats-data
This commit is contained in:
parent
63be819661
commit
29584197bb
|
@ -64,7 +64,6 @@ def start(_type, _args) do
|
||||||
Config.TransferTask,
|
Config.TransferTask,
|
||||||
Pleroma.Emoji,
|
Pleroma.Emoji,
|
||||||
Pleroma.Web.Plugs.RateLimiter.Supervisor,
|
Pleroma.Web.Plugs.RateLimiter.Supervisor,
|
||||||
Pleroma.Web.Telemetry,
|
|
||||||
{Task.Supervisor, name: Pleroma.TaskSupervisor}
|
{Task.Supervisor, name: Pleroma.TaskSupervisor}
|
||||||
] ++
|
] ++
|
||||||
cachex_children() ++
|
cachex_children() ++
|
||||||
|
@ -74,7 +73,8 @@ def start(_type, _args) do
|
||||||
Pleroma.JobQueueMonitor,
|
Pleroma.JobQueueMonitor,
|
||||||
{Majic.Pool, [name: Pleroma.MajicPool, pool_size: Config.get([:majic_pool, :size], 2)]},
|
{Majic.Pool, [name: Pleroma.MajicPool, pool_size: Config.get([:majic_pool, :size], 2)]},
|
||||||
{Oban, Config.get(Oban)},
|
{Oban, Config.get(Oban)},
|
||||||
Pleroma.Web.Endpoint
|
Pleroma.Web.Endpoint,
|
||||||
|
Pleroma.Web.Telemetry
|
||||||
] ++
|
] ++
|
||||||
elasticsearch_children() ++
|
elasticsearch_children() ++
|
||||||
task_children(@mix_env) ++
|
task_children(@mix_env) ++
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
defmodule Pleroma.Web.Telemetry do
|
defmodule Pleroma.Web.Telemetry do
|
||||||
use Supervisor
|
use Supervisor
|
||||||
import Telemetry.Metrics
|
import Telemetry.Metrics
|
||||||
|
alias Pleroma.Stats
|
||||||
|
|
||||||
def start_link(arg) do
|
def start_link(arg) do
|
||||||
Supervisor.start_link(__MODULE__, arg, name: __MODULE__)
|
Supervisor.start_link(__MODULE__, arg, name: __MODULE__)
|
||||||
|
@ -103,11 +104,23 @@ def metrics do
|
||||||
reporter_options: [
|
reporter_options: [
|
||||||
buckets: [0.01, 0.025, 0.05, 0.1, 0.2, 0.5, 1, 2.5, 5, 10]
|
buckets: [0.01, 0.025, 0.05, 0.1, 0.2, 0.5, 1, 2.5, 5, 10]
|
||||||
]
|
]
|
||||||
)
|
),
|
||||||
|
last_value("pleroma.local_users.total"),
|
||||||
|
last_value("pleroma.domains.total"),
|
||||||
|
last_value("pleroma.local_statuses.total")
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
defp periodic_measurements do
|
defp periodic_measurements do
|
||||||
[]
|
[
|
||||||
|
{__MODULE__, :instance_stats, []}
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
def instance_stats do
|
||||||
|
stats = Stats.get_stats()
|
||||||
|
:telemetry.execute([:pleroma, :local_users], %{total: stats.user_count}, %{})
|
||||||
|
:telemetry.execute([:pleroma, :domains], %{total: stats.domain_count}, %{})
|
||||||
|
:telemetry.execute([:pleroma, :local_statuses], %{total: stats.status_count}, %{})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue