Phoenix 1.5.1 is out and so I fired up a new app to see what’s LiveDashboard is all about.

Features

  • Interact with users and know who is connected right now, across one or dozens of nodes, by using our built-in Channels and Presence technologies. Or try LiveView for a refreshing new way to develop real-time apps without the client-side complexities.
  • At its core, Phoenix is a rock-solid web framework that improves the tried and true Model-View-Controller (MVC) architecture with a fresh set of functional ideas. Phoenix puts the focus on your business domain, bringing you immediate productivity and long-term code maintainability.
  • Forget about complex messaging systems or about 3rd party tools to manage layers of cache. Phoenix uses the Erlang VM capabilities to implement its real time system and to scale out-of-the-box. This reduces operational complexity and decreases developers cognitive load.
  • Phoenix accompanies you and your team from development to production. It ships with built-in instrumentation and a live dashboard that gives you insight into the Erlang VM ability to handle millions of connections alongside Elixir's tooling for building robust systems.

Assuming you have Elixir and Mix available install new Phoenix version as:

$ mix archive.install hex phx_new
$ mix phx.new demo --live
$ cd demo/
$ mix ecto.create

Assuming you have PostgreSQL running and set up with postgres user’s password set to postgres a new database should be created. To test drive Phoenix 1.5 properly let’s also include the new phx_gen_auth package that contains the new user authentication generators. This will also give us a few pages to walk through for the Request Logger testing. Add the dependency as any other:

{:phx_gen_auth, "~> 0.1.0"}

Install dependencies with
mix deps.get

$ mix deps.get
$ mix phx.gen.auth Accounts Users user
$ mix deps.get
$ mix ecto.migrate
$ mix phx.server

Once done, we should see a server running at http://localhost:4000/.

Phoenix Live

Phoenix Live Dashboard

LiveDashboard is the feature of Phoenix 1.5 release. As the name suggests it’s a dashboard built using LiveView.

LiveDashboard can be found at http://localhost:4000/dashboard and it will automatically preselect our localhost node.

LiveDashboard comes packed with various things. It has the following features: Home (cpu, memory, io breakdown) Metrics (think telemetry) Request Logger (web version of console logs on steroids) Processes (kind of web version of:observer)

Request Logger

If we navigate to the Request Logger in the main tab navigation of Phoenix LiveDashboard we will be greeted by three different cards. The first one is the Logs. Here will our logs appear.

The second is the Query Parameter which gives us a ?request_logger= parameter that we can just include in the page request to see the logs of that particular request. If you are thinking that you can just look at console logs think again. This enables you to debug a request on a running system (with possible log noise) and you don’t even have to be the person invoking the request.

Request Logger

I think that’s fantastic. Even though most of us are gathering logs somewhere finding a particular request is always annoying. Many scenarios now might even go without a logging service at all.

But that’s not all.

If you are debugging your requests, there is a third card called Cookie Parameter that gives you a magic button to Enable cookie for debugging. Once enabled all your requests (all from the browser you are using at the time) automatically show in the Logs on the page.

Just open a new tab and try the new Phoenix sign up and login workflows. Watch the Logs card populate with your logs.

Even if you are debugging a running system with a lot of noise, you will always know what’s happening with your particular requests. Do I have to write more? I don’t think so. Go on and upgrade your Phoenix apps!