diff options
author | rinpatch <rinpatch@sdf.org> | 2020-05-08 18:18:59 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-07-15 15:26:35 +0300 |
commit | 1b15cb066c612c72d106e7e7026819ea14e0ceab (patch) | |
tree | 567c191db1d458d03bd4705b266cd93aa49e708d /lib/pleroma/telemetry/logger.ex | |
parent | e94ba05e523d735cd7a357a3aa30e433f60ef9a3 (diff) | |
download | pleroma-1b15cb066c612c72d106e7e7026819ea14e0ceab.tar.gz |
Connection pool: Add client death tracking
While running this in production I noticed a number of ghost
processes with all their clients dead before they released the connection,
so let's track them to log it and remove them from clients
Diffstat (limited to 'lib/pleroma/telemetry/logger.ex')
-rw-r--r-- | lib/pleroma/telemetry/logger.ex | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/pleroma/telemetry/logger.ex b/lib/pleroma/telemetry/logger.ex index d76dd37b5..4cacae02f 100644 --- a/lib/pleroma/telemetry/logger.ex +++ b/lib/pleroma/telemetry/logger.ex @@ -6,7 +6,8 @@ defmodule Pleroma.Telemetry.Logger do @events [ [:pleroma, :connection_pool, :reclaim, :start], [:pleroma, :connection_pool, :reclaim, :stop], - [:pleroma, :connection_pool, :provision_failure] + [:pleroma, :connection_pool, :provision_failure], + [:pleroma, :connection_pool, :client_death] ] def attach do :telemetry.attach_many("pleroma-logger", @events, &handle_event/4, []) @@ -59,4 +60,17 @@ defmodule Pleroma.Telemetry.Logger do "Connection pool had to refuse opening a connection to #{key} due to connection limit exhaustion" end) end + + def handle_event( + [:pleroma, :connection_pool, :client_death], + %{client_pid: client_pid, reason: reason}, + %{key: key}, + _ + ) do + Logger.warn(fn -> + "Pool worker for #{key}: Client #{inspect(client_pid)} died before releasing the connection with #{ + inspect(reason) + }" + end) + end end |