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

fix: Recon error workaround. #2267

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Changes from 1 commit
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
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.
Copy link
Contributor

@digitalcora digitalcora Oct 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than putting an assertion like this in a comment where it can drift apart from the actual status of the issue, I'd prefer updating the issue itself, which I've just done. (at some later time, presumably, the issue will be closed and fixed)

@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
Loading