-
Notifications
You must be signed in to change notification settings - Fork 42
Prometheus and Grafana
Kieran edited this page Jan 14, 2025
·
8 revisions
You can optionally use Pinchflat's Prometheus agent if you want to collect application metrics. Note that these are generic metrics more related to performance rather than being application-specific metrics about things like, say, video size on disk. I'm open to PRs if you want to capture different metrics!
- Prometheus has been installed (docs)
- If you're on Unraid or another managed selfhosting platform, look for "Prometheus" in your server's app store
- Grafana has been installed (docs)
- If you're on Unraid or another managed selfhosting platform, look for "Grafana" in your server's app store
- Prometheus has been added as a datasource within Grafana (docs)
If you have trouble with any of these steps, please look for support within their respective communities
Set the ENABLE_PROMETHEUS
environment variable to any non-empty value. Then, update your Prometheus config to include Pinchflat:
scrape_configs:
- job_name: pinchflat
static_configs:
- targets: ['your.server.ip:8945']
The app includes some pre-made Grafana dashboards to simplify visualization. The ones to choose from are:
application.json
-
beam.json
(the underlying Erlang virtual machine) -
phoenix.json
(the web framework itself) -
ecto.json
(the database connector) -
oban.json
(the job runner) -
phoenix_live_view.json
(the websocket tech that renders certain views)
Here's how to add them to Grafana:
- In Grafana, go to Connections > Data Sources > Select your Prometheus data source > take note of the "Name" field. We'll need this later
- Select the dashboard you want from here
- If your data source name from above is anything EXCEPT
prometheus
you'll need to do some extra steps:- Copy the JSON for the dashboard into your editor of choice
- Perform a find + replace. You want to find
"datasource": "prometheus"
and replace that with"datasource": "<data source name from above>"
- In Grafana, go to Dashboards > New > Import then paste in the JSON for the dashboard. Click "Load"
- Repeat for the other dashboards you're interested in!