-
Notifications
You must be signed in to change notification settings - Fork 189
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
Report broken for long_running_queries since Ecto 3.12.0 #458
Comments
I believe there is something else going on here. Ecto only uses
Did you set that option by any chance in your project? |
Yup, I suspected that some magic was happening too here, thanks for pointing us to the right direction. We do have a line that looks like this: Postgrex.Types.define(AppCore.PostgrexTypes, [AppCore.PostgrexTypes.ExtCitext], interval_decode_type: Duration) Can we somehow exclude the live_dashboard here? |
Since this is set at the repo level we could create a new Repo without these options, but then... have to remember that the main repo will crash on those tabs. If i'm following correctly. |
I will submit a PR to Elixir and the Ecto stats project. But it will require Elixir v1.18. Meanwhile you can remove the option or disable these pages from the dashboard (or use a separate repo). |
We don't mind those pages crashing if we know why, we have other tools to get the long running queries in the meantime. The main driver for opening this issue was letting people know in case they ran in the same problem, as we didn't find any existing reports. Thank you for the help troubleshooting and for handling it, no rush. Shall I close the issue? |
@josevalim I am still seeing the issue. It seems we are not actually calling This change based on your change fixed it for me: --- lib/phoenix/live_dashboard/pages/ecto_stats_page.ex 2024-12-30 18:11:20.089569036 +0530
+++ lib/phoenix/live_dashboard/pages/ecto_stats_page.ex 2024-12-30 18:14:23.821469335 +0530
@@ -3,7 +3,7 @@
use Phoenix.LiveDashboard.PageBuilder
import Phoenix.LiveDashboard.Helpers
- @compile {:no_warn_undefined, [Decimal, EctoPSQLExtras, {Ecto.Repo, :all_running, 0}]}
+ @compile {:no_warn_undefined, [Decimal, Duration, EctoPSQLExtras, {Ecto.Repo, :all_running, 0}]}
@disabled_link "https://hexdocs.pm/phoenix_live_dashboard/ecto_stats.html"
@page_title "Ecto Stats"
@@ -277,7 +277,7 @@
{sorted, length(rows)}
end
- defp format(_, %struct{} = value) when struct in [Decimal, Postgrex.Interval],
+ defp format(_, %struct{} = value) when struct in [Decimal, Duration, Postgrex.Interval],
do: struct.to_string(value)
defp format(:bytes, value) when is_integer(value), EnvironmentAll are latest versions:
|
@akash-akya your change looks good to me, opened #464! |
From my understanding, Ecto starting parsing :duration as
%Duration
structs in v3.12.0. We've seen a few errors that I attribute to the new type but I may be wrong.Environment
Actual behavior
When accessing the dahsboard for long_running_queries, I get a 500. It works if they aren't any long queries.
How to repro :
MyApp.Repo.query!("select pg_sleep(5 * 60);")
On prod the error is
phoenix_live_dashboard/lib/phoenix/live_dashboard/pages/ecto_stats_page.ex
Line 256 in 6aecd3b
On local, don't have exactly this one, I have
Phoenix.HTML.Safe not implemented for %Duration{}
.Expected behavior
No 500 if there are long running queries
The text was updated successfully, but these errors were encountered: