Monitoring your Elixir app with Prometheus

Monitoring your Elixir app with Prometheus
Average rating: 3
(2 votes)

Thanks! You’ve rated this material!

Over the past few years, Prometheus has emerged as one of the leading options for gathering metrics and alerting. Why don’t you start monitoring your Elixir app with Prometheus? We found a small intro that will help you with setting instrumentation and viewing your metrics.

Prometheus is a self-hosted metrics platform that ingests data by scraping a web endpoint. This ends up working well in Elixir apps since we can keep the common state in the whole application fairly easily.

  1. You need to instrument our Elixir application. This is very simple with the prometheus.ex library.
  2. To get Prometheus to scrape your application you need to set up a new scrape config.
  3. Next, we set up the exporter with a new module and then adding it to your Endpoint.
  4. Now, whenever a “command” is used in your app you can simply call this new function and prometheus will track everything for you.
  5. Once you have configured for your Prometheus instance, you can create a new dashboard. Inside that dashboard make a new graph panel.

If you want to look over a real application that implements all of this, check here.

While you can use Prometheus with Ruby as well, we want you to compare Ruby and Elixir to find out which technology fits better for different projects.

Rate this article, if you like it

Thanks! You’ve rated this material!

Got a project? Let's discuss it!

    Kyiv Sofiivska 1/2a, 01001, Kyiv, Ukraine
    Dnipro Hlinky 2, of. 1003, 49000, Dnipro, Ukraine
    Kharkiv Otakara Yarosha 22, 61000, Kharkiv, Ukraine