Local Prometheus server

To test Prometheus locally, we will use Docker Compose to spin up a Prometheus container alongside the Postgres and ElixirDrip container we already have. The Prometheus container will also expose its port, and will hit the /metrics endpoint to scrape the application metrics. The Prometheus server knows about its targets through a configuration file. Let's create ours:

$ cat monitoring/prometheus.dev.ymlglobal:  scrape_interval: 15sscrape_configs:  - job_name: 'prometheus'    static_configs:      - targets: ['localhost:9090']  - job_name: 'elixir-drip'    static_configs:      - targets: ['app:4000']

As you can see, it is a YAML file that points to the available Prometheus targets. Our configuration is really simple, but you can configure ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.