Fly.ioTutorial
Monitoring Elixir Apps on Fly.io With Prometheus and PromEx
Summary
Monitoring Elixir applications on Fly.io, the post presents a way to add production visibility without administering a Prometheus instance. Fly.io’s managed service scrapes an application’s metrics endpoint at a configured interval, with fly.toml specifying the port and path; Prometheus stores the resulting time-series snapshots and Grafana queries them with PromQL. PromEx supplies Elixir instrumentation through plugins for components such as the application, BEAM, Phoenix, Ecto, and Phoenix LiveView, while optionally uploading dashboards and annotating application lifecycle events through Grafana’s HTTP API. The example enables Fly.io metrics on port 4000 at /metrics and configures PromEx dashboards for a Todo List application. The stated result is an instrumented application with dashboards and annotations in minutes, while monitoring can also support rollback decisions, stress-test analysis, prioritization, and capacity planning.
Context
The post addresses the need to detect production application errors and suboptimal behavior without exhaustively testing every API route and input permutation after each deployment. It also frames monitoring as useful for quantifying stress tests, planning business priorities from real usage data, and assessing system performance and capacity.
Approach / What changed
Enable Fly.io’s managed Prometheus integration by declaring the metrics port and path in fly.toml, then use PromEx in the Elixir application to collect metrics through configurable plugins. PromEx can also upload selected Grafana dashboards through the Grafana HTTP API and annotate application lifecycle events when configured with Grafana host and authentication details.
Takeaways
Prometheus scrapes each application instance through a GET request to /metrics or another configured endpoint, so time-series resolution is limited by the scrape interval.
PromEx uses plugins to instrument Elixir components, including the BEAM, Phoenix, Ecto, and Phoenix LiveView, and provides corresponding Grafana dashboards.
The example exposes metrics on port 4000, configures PromEx dashboards for a Todo List application, and enables dashboard upload and lifecycle annotations at startup.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.