Merge branch 'account-notes' into 'develop'
[akkoma] / docs / development / API / prometheus.md
1 # Prometheus Metrics
2
3 Pleroma includes support for exporting metrics via the [prometheus_ex](https://github.com/deadtrickster/prometheus.ex) library.
4
5 Config example:
6
7 ```
8 config :prometheus, Pleroma.Web.Endpoint.MetricsExporter,
9 enabled: true,
10 auth: {:basic, "myusername", "mypassword"},
11 ip_whitelist: ["127.0.0.1"],
12 path: "/api/pleroma/app_metrics",
13 format: :text
14 ```
15
16 * `enabled` (Pleroma extension) enables the endpoint
17 * `ip_whitelist` (Pleroma extension) could be used to restrict access only to specified IPs
18 * `auth` sets the authentication (`false` for no auth; configurable to HTTP Basic Auth, see [prometheus-plugs](https://github.com/deadtrickster/prometheus-plugs#exporting) documentation)
19 * `format` sets the output format (`:text` or `:protobuf`)
20 * `path` sets the path to app metrics page
21
22
23 ## `/api/pleroma/app_metrics`
24
25 ### Exports Prometheus application metrics
26
27 * Method: `GET`
28 * Authentication: not required by default (see configuration options above)
29 * Params: none
30 * Response: text
31
32 ## Grafana
33
34 ### Config example
35
36 The following is a config example to use with [Grafana](https://grafana.com)
37
38 ```
39 - job_name: 'beam'
40 metrics_path: /api/pleroma/app_metrics
41 scheme: https
42 static_configs:
43 - targets: ['pleroma.soykaf.com']
44 ```