projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added wrapper Pleroma.HTTP for ExAws.S3
[akkoma]
/
lib
/
pleroma
/
healthcheck.ex
diff --git
a/lib/pleroma/healthcheck.ex
b/lib/pleroma/healthcheck.ex
index 977b78c268d8ab59f2af297069a6eb44966725bc..92ce83cb7ba6669397b467d01799aaa0bb72e257 100644
(file)
--- a/
lib/pleroma/healthcheck.ex
+++ b/
lib/pleroma/healthcheck.ex
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Healthcheck do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Healthcheck do
@@
-14,6
+14,7
@@
defmodule Pleroma.Healthcheck do
active: 0,
idle: 0,
memory_used: 0,
active: 0,
idle: 0,
memory_used: 0,
+ job_queue_stats: nil,
healthy: true
@type t :: %__MODULE__{
healthy: true
@type t :: %__MODULE__{
@@
-21,15
+22,17
@@
defmodule Pleroma.Healthcheck do
active: non_neg_integer(),
idle: non_neg_integer(),
memory_used: number(),
active: non_neg_integer(),
idle: non_neg_integer(),
memory_used: number(),
+ job_queue_stats: map(),
healthy: boolean()
}
@spec system_info() :: t()
def system_info do
%Healthcheck{
healthy: boolean()
}
@spec system_info() :: t()
def system_info do
%Healthcheck{
- memory_used: Float.round(:
erlang.memory(:total
) / 1024 / 1024, 2)
+ memory_used: Float.round(:
recon_alloc.memory(:allocated
) / 1024 / 1024, 2)
}
|> assign_db_info()
}
|> assign_db_info()
+ |> assign_job_queue_stats()
|> check_health()
end
|> check_health()
end
@@
-55,6
+58,11
@@
defmodule Pleroma.Healthcheck do
Map.merge(healthcheck, db_info)
end
Map.merge(healthcheck, db_info)
end
+ defp assign_job_queue_stats(healthcheck) do
+ stats = Pleroma.JobQueueMonitor.stats()
+ Map.put(healthcheck, :job_queue_stats, stats)
+ end
+
@spec check_health(Healthcheck.t()) :: Healthcheck.t()
def check_health(%{pool_size: pool_size, active: active} = check)
when active >= pool_size do
@spec check_health(Healthcheck.t()) :: Healthcheck.t()
def check_health(%{pool_size: pool_size, active: active} = check)
when active >= pool_size do