mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-07 05:52:57 +00:00
docs: Add documentation for prometheus-middleware
This commit is contained in:
20
README.md
20
README.md
@@ -62,6 +62,25 @@ getting elasticsearch to work, have a look in the
|
||||
[README](https://gitlab.com/openstapps/database) of the image
|
||||
first.
|
||||
|
||||
## Metrics collection
|
||||
The backend contains an express middleware which can be optionally enabled by setting the environment variable
|
||||
`PROMETHEUS_MIDDLEWARE` to `true`. The middleware collects metrics and provides a [Prometheus](https://prometheus.io/)
|
||||
compatible endpoint from which the metrics may be scraped by Prometheus.
|
||||
|
||||
The middleware may be configured with JSON provided in `config/prometheus.json`, i.e.
|
||||
|
||||
```JSON
|
||||
{
|
||||
"metricsPath": "/metrics",
|
||||
"collectDefaultMetrics": true,
|
||||
"requestDurationBuckets": [0.1, 0.5, 1, 2],
|
||||
"requestLengthBuckets": [512, 1024, 5120, 10240, 51200, 102400],
|
||||
"responseLengthBuckets": [512, 1024, 5120, 10240, 51200, 102400]
|
||||
}
|
||||
```
|
||||
|
||||
You can get a compatible grafana dashboard at [grafana.com](https://grafana.com/grafana/dashboards/14565).
|
||||
|
||||
## Start backend
|
||||
Run `npm install` and `npm run build`, then start with `npm start`. The server should now be accepting connections at `http://localhost:3000`.
|
||||
|
||||
@@ -79,6 +98,7 @@ The list of environment variables includes:
|
||||
* `ES_FORCE_MAPPING_UPDATE` when this variable is set to `true`, the backend will always generate a new Elasticsearch mapping from the core regardless of whether there is already a version present. This should only really be used when you are working on the core.
|
||||
* `ALLOW_NO_TRANSPORT` if set to true, the backend will allow starting without an Email configured that receives critical errors.
|
||||
* `ES_DEBUG` setting this to `true` will result in Elasticsearch logging to be **VERY** extensive, in almost all situation this should no be enabled.
|
||||
* `PROMETHEUS_MIDDLEWARE` if set to `true` will enable metrics collection with [Express Prometheus Middleware](https://www.npmjs.com/package/express-prometheus-middleware)
|
||||
|
||||
## Config files
|
||||
Each university can have it's specific config for the general backend and app and for all databases.
|
||||
|
||||
Reference in New Issue
Block a user