Current section

43 Versions

Jump to

Compare versions

6 files changed
+30 additions
-6 deletions
  @@ -1,5 +1,11 @@
1 1 # CHANGELOG
2 2
3 + ## v0.6.3 (2022-01-30)
4 +
5 + * Fix crash on metrics page when none of the tags specified in a metric are found
6 + * Fix crash on OS data when CPU information cannot be retrieved
7 + * Do not generate compile-time dependencies for dashboard parameters
8 +
3 9 ## v0.6.2 (2021-12-07)
4 10
5 11 * Improve navigation on Ecto Stats page
  @@ -89,4 +89,4 @@
89 89 {<<"optional">>,true},
90 90 {<<"repository">>,<<"hexpm">>},
91 91 {<<"requirement">>,<<"~> 3.6.2 or ~> 3.7">>}]]}.
92 - {<<"version">>,<<"0.6.2">>}.
92 + {<<"version">>,<<"0.6.3">>}.
  @@ -41,8 +41,12 @@ defmodule Phoenix.LiveDashboard.OSMonPage do
41 41 )
42 42 end
43 43
44 - defp cpu_components(%{os_mon: %{cpu_avg1: num}} = row_params) when is_number(num) do
45 - [[cpu_load_row(row_params), cpu_avg_row(row_params)]]
44 + defp cpu_components(%{os_mon: %{cpu_avg1: num1, cpu_avg5: num5, cpu_avg15: num15}} = row_params)
45 + when is_number(num1) and is_number(num5) and is_number(num15) do
46 + [
47 + [cpu_load_row(row_params)] ++
48 + if(row_params.cpu_count > 0, do: [cpu_avg_row(row_params)], else: [])
49 + ]
46 50 end
47 51
48 52 defp cpu_components(%{}), do: []
  @@ -90,6 +90,13 @@ defmodule Phoenix.LiveDashboard.Router do
90 90
91 91 """
92 92 defmacro live_dashboard(path, opts \\ []) do
93 + opts =
94 + if Macro.quoted_literal?(opts) do
95 + Macro.prewalk(opts, &expand_alias(&1, __CALLER__))
96 + else
97 + opts
98 + end
99 +
93 100 quote bind_quoted: binding() do
94 101 scope path, alias: false, as: false do
95 102 {session_name, session_opts, route_opts} = Phoenix.LiveDashboard.Router.__options__(opts)
  @@ -105,6 +112,11 @@ defmodule Phoenix.LiveDashboard.Router do
105 112 end
106 113 end
107 114
115 + defp expand_alias({:__aliases__, _, _} = alias, env),
116 + do: Macro.expand(alias, %{env | function: {:live_dashboard, 2}})
117 +
118 + defp expand_alias(other, _env), do: other
119 +
108 120 @doc false
109 121 def __options__(options) do
110 122 live_socket_path = Keyword.get(options, :live_socket_path, "/live")
  @@ -63,8 +63,10 @@ defmodule Phoenix.LiveDashboard.TelemetryListener do
63 63 %{} -> acc
64 64 end
65 65 end)
66 - |> Enum.reduce(&[&1, " " | &2])
67 - |> IO.iodata_to_binary()
66 + |> case do
67 + [] -> nil
68 + reversed_tags -> reversed_tags |> Enum.reduce(&[&1, " " | &2]) |> IO.iodata_to_binary()
69 + end
68 70 end
69 71
70 72 @impl true
Loading more files…