Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer process name over label if both are set #447

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/phoenix/live_dashboard/system_info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,8 @@ defmodule Phoenix.LiveDashboard.SystemInfo do
initial_call = Keyword.get(dictionary, :"$initial_call", initial_call)

name =
format_process_label(Keyword.get(dictionary, :"$process_label")) ||
format_registered_name(name) ||
format_registered_name(name) ||
format_process_label(Keyword.get(dictionary, :"$process_label")) ||
format_initial_call(initial_call)

{name, initial_call}
Expand Down
12 changes: 12 additions & 0 deletions test/phoenix/live_dashboard/system_info_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ defmodule Phoenix.LiveDashboard.SystemInfoTest do
assert pid == {:pid, agent_pid}
assert name == {:name_or_initial_call, "test label"}
end

test "all with search by name if both name and label are set" do
{:ok, agent_pid} =
Agent.start_link(fn -> Process.set_label("test label") end, name: :test_agent)

{pids, _count, _} =
SystemInfo.fetch_processes(node(), "test_agent", :memory, :asc, 100)

assert [[pid, name | _]] = pids
assert pid == {:pid, agent_pid}
assert name == {:name_or_initial_call, ":test_agent"}
end
end

test "allows previous reductions param" do
Expand Down
Loading