title: How do I detect database connection issues from Elixir Ecto?
body: <p>I am writing an Elixir project that connects to a Postgres database via Ecto.  The database server is on a different server from the application itself, and is more subject to outages that would not affect the Elixir project than if they were running on the same hardware.</p>
  
  <p>When the application starts normally, the database connection seems to be made automatically, and everything works fine.  But if there is a connection error, Ecto simply spews any errors into the log.</p>
  
  <p>What I would like to do is detect the current connection status, and report that information via a simple Plug route to an external load balancer, such that traffic can be routed to a separate server with an active connection.</p>
  
  <p>The trouble is, I'm unsure how to determine if Ecto has a viable connection to the database, apart from listening to the log, which doesn't then report that the database connection has been restored.</p>
  
  <p>What can I call to determine if an Ecto connection is live and usable, preferably without making no-op queries against that connection?</p>