Imison

An error tracker that runs inside your Phoenix app.

Imison captures your app's errors, groups them, stores them in your app's own Postgres database and shows them on a dashboard mounted in your router. When something new breaks, it tells you by email, Slack or webhook. You don't need a separate service, an account or an API key: you add it like Oban, with one dependency, one install task and one migration.

The Imison error list

Why Imison

Hosted error trackers are good, but for many Phoenix apps they're more than the job needs:

Imison takes the other route. Everything an error tracker needs is already in a Phoenix app: a database, a PubSub, a mailer, a router and LiveView. Imison reuses them:

The trade-off: errors are stored in your app's database, so an outage of that database can't be recorded. It only reaches your logs.

What it does

An error's detail page

Quick start

Requirements: Elixir 1.20+, Phoenix with LiveView, Ecto on PostgreSQL.

# mix.exs
{:imison, "~> 0.1"},
{:igniter, "~> 0.8", only: [:dev]}
mix deps.get
mix imison.install
mix ecto.migrate

mix imison.install does four things:

It shows each change and asks before writing it. Without Igniter, it prints the steps for you to apply by hand.

Start your app, open http://localhost:4000/errors and sign in. Every unhandled exception from now on shows up there.

In production, set the dashboard login in the environment:

IMISON_USER=ops IMISON_PASSWORD="a long random password"

Report a rescued exception

try do
  MyApp.Payments.charge(order)
rescue
  exception ->
    Imison.report(exception, __STACKTRACE__, %{order_id: order.id})
    {:error, :charge_failed}
end

Get notified

Set your mailer and sender:

config :my_app, Imison,
  mailer: MyApp.Mailer,
  from: "errors@example.com",
  dashboard_url: "https://app.example.com/errors"

Then, on the dashboard's Notifications screen, enter recipients on the Email panel, switch it on and save. To post to Slack or a webhook too, list them in channels, together with Email, since the list replaces the default:

config :my_app, Imison,
  channels: [
    Imison.Notifications.Channels.Email,
    Imison.Notifications.Channels.Slack,
    Imison.Notifications.Channels.Webhook
  ]

Documentation

Guide What's in it
Getting started Installing, the first error, installing by hand
Using the dashboard Signing in, the error list, statuses, search, the detail page, muting
Capturing errors What is captured, grouping, Imison.report/3, filter, ignore, release
Notifications Rules, email, Slack, webhooks and signature checks, delivery records
Writing a notification channel The channel behaviour, a complete PagerDuty example, testing it
Configuration Every option, the route, migrations, retention, several nodes, production checklist

The API reference is in the module docs: Imison, Imison.Config, Imison.Migration, Imison.Web.Router, Imison.Notifications.Channel and Imison.Notifications.Message. Build everything as HTML with mix docs.

Status

Version 0.1. Every feature above is built and tested, but the API may change before 1.0. Schema changes ship as new Imison.Migration versions, the way Oban's do.

Development

mix deps.get
mix check          # compile with warnings as errors, unused deps, format, Credo, tests
mix test           # tests only; needs Postgres at postgres:postgres@localhost:5432
mix docs           # HTML docs in doc/

Some details about the tests:

To try Imison in a real host, keep a small Phoenix app in dev/ with a path dependency ({:imison, path: ".."}). dev/ is gitignored, so each maintainer keeps their own.

For contributors: