Skip to content

Commit

Permalink
Add workaround for an error.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaddox5 committed Oct 28, 2024
1 parent d22dd73 commit 3f760c7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/screens/health.ex
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,20 @@ defmodule Screens.Health do
defp process_metrics({pid, name, supervisor}) do
metrics =
pid
|> :recon.info(@process_metrics)
|> safe_recon_info(@process_metrics)
|> Stream.map(fn {metric, value} -> "#{metric}=#{value}" end)
|> Enum.intersperse(" ")

{name, supervisor, metrics}
end

# work around https://github.com/ferd/recon/issues/95
# The issue is closed but is still very much an issue.
@spec safe_recon_info(pid(), [atom()]) ::
[] | [{:recon.info_type(), [{:recon.info_key(), term()}]}]
defp safe_recon_info(pid, metrics) do
:recon.info(pid, metrics)
rescue
FunctionClauseError -> []
end
end

0 comments on commit 3f760c7

Please sign in to comment.