Skip to content

Commit 4e6e8b9

Browse files
Prefer process name over label if both are set (#447)
1 parent c1f57b8 commit 4e6e8b9

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/phoenix/live_dashboard/system_info.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,8 @@ defmodule Phoenix.LiveDashboard.SystemInfo do
803803
initial_call = Keyword.get(dictionary, :"$initial_call", initial_call)
804804

805805
name =
806-
format_process_label(Keyword.get(dictionary, :"$process_label")) ||
807-
format_registered_name(name) ||
806+
format_registered_name(name) ||
807+
format_process_label(Keyword.get(dictionary, :"$process_label")) ||
808808
format_initial_call(initial_call)
809809

810810
{name, initial_call}

test/phoenix/live_dashboard/system_info_test.exs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ defmodule Phoenix.LiveDashboard.SystemInfoTest do
5959
assert pid == {:pid, agent_pid}
6060
assert name == {:name_or_initial_call, "test label"}
6161
end
62+
63+
test "all with search by name if both name and label are set" do
64+
{:ok, agent_pid} =
65+
Agent.start_link(fn -> Process.set_label("test label") end, name: :test_agent)
66+
67+
{pids, _count, _} =
68+
SystemInfo.fetch_processes(node(), "test_agent", :memory, :asc, 100)
69+
70+
assert [[pid, name | _]] = pids
71+
assert pid == {:pid, agent_pid}
72+
assert name == {:name_or_initial_call, ":test_agent"}
73+
end
6274
end
6375

6476
test "allows previous reductions param" do

0 commit comments

Comments
 (0)