Skip to content

Commit 86ea0c1

Browse files
committed
Label more internal processes
This is to improve error messages
1 parent c2fd173 commit 86ea0c1

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed

lib/db_connection/connection_pool.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ defmodule DBConnection.ConnectionPool do
5151

5252
@impl GenServer
5353
def init({mod, opts}) do
54+
Util.set_label(__MODULE__)
5455
DBConnection.register_as_pool(mod)
5556

5657
queue = :ets.new(__MODULE__.Queue, [:protected, :ordered_set, decentralized_counters: true])

lib/db_connection/connection_pool/pool.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
defmodule DBConnection.ConnectionPool.Pool do
22
@moduledoc false
33
use Supervisor, restart: :temporary
4+
alias DBConnection.Util
45

56
def start_supervised(tag, mod, opts) do
67
DBConnection.Watcher.watch(
@@ -15,6 +16,7 @@ defmodule DBConnection.ConnectionPool.Pool do
1516

1617
@impl true
1718
def init({owner, tag, mod, opts}) do
19+
Util.set_label(__MODULE__)
1820
size = Keyword.get(opts, :pool_size, 1)
1921

2022
if size < 1, do: raise(ArgumentError, "pool size must be greater or equal to 1, got #{size}")

lib/db_connection/ownership/manager.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ defmodule DBConnection.Ownership.Manager do
7171

7272
@impl true
7373
def init({module, owner_opts, pool_opts}) do
74+
Util.set_label(__MODULE__)
7475
DBConnection.register_as_pool(module)
7576

7677
ets =

lib/db_connection/telemetry_listener.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ defmodule DBConnection.TelemetryListener do
6060
"""
6161

6262
use GenServer
63+
alias DBConnection.Util
6364

6465
@doc "Starts a telemetry listener"
6566
@spec start_link(GenServer.options()) :: {:ok, pid()}
@@ -69,6 +70,7 @@ defmodule DBConnection.TelemetryListener do
6970

7071
@impl GenServer
7172
def init(nil) do
73+
Util.set_label(__MODULE__)
7274
{:ok, %{monitoring: %{}}}
7375
end
7476

lib/db_connection/watcher.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ defmodule DBConnection.Watcher do
33
@name __MODULE__
44

55
use GenServer
6+
alias DBConnection.Util
67

78
def start_link(_) do
89
GenServer.start_link(__MODULE__, :ok, name: @name)
@@ -14,6 +15,7 @@ defmodule DBConnection.Watcher do
1415

1516
@impl true
1617
def init(:ok) do
18+
Util.set_label(__MODULE__)
1719
Process.flag(:trap_exit, true)
1820
{:ok, {%{}, %{}}}
1921
end

0 commit comments

Comments
 (0)