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.
- You need to instrument our Elixir application. This is very simple with the prometheus.ex library.
- To get Prometheus to scrape your application you need to set up a new scrape config.
- Next, we set up the exporter with a new module and then adding it to your Endpoint.
- Now, whenever a “command” is used in your app you can simply call this new function and prometheus will track everything for you.
- 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.