mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Improve documentation how to configure prometheus for workers (#8822)
This commit is contained in:
parent
3f0ff53158
commit
14f81a6d24
1
changelog.d/8822.doc
Normal file
1
changelog.d/8822.doc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Improve documentation how to configure prometheus for workers.
|
@ -20,6 +20,7 @@ Add a new job to the main prometheus.conf file:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### for Prometheus v2
|
### for Prometheus v2
|
||||||
|
|
||||||
Add a new job to the main prometheus.yml file:
|
Add a new job to the main prometheus.yml file:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -29,9 +30,12 @@ Add a new job to the main prometheus.yml file:
|
|||||||
scheme: "https"
|
scheme: "https"
|
||||||
|
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['SERVER.LOCATION:PORT']
|
- targets: ["my.server.here:port"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
An example of a Prometheus configuration with workers can be found in
|
||||||
|
[metrics-howto.md](https://github.com/matrix-org/synapse/blob/master/docs/metrics-howto.md).
|
||||||
|
|
||||||
To use `synapse.rules` add
|
To use `synapse.rules` add
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -13,10 +13,12 @@
|
|||||||
can be enabled by adding the \"metrics\" resource to the existing
|
can be enabled by adding the \"metrics\" resource to the existing
|
||||||
listener as such:
|
listener as such:
|
||||||
|
|
||||||
|
```yaml
|
||||||
resources:
|
resources:
|
||||||
- names:
|
- names:
|
||||||
- client
|
- client
|
||||||
- metrics
|
- metrics
|
||||||
|
```
|
||||||
|
|
||||||
This provides a simple way of adding metrics to your Synapse
|
This provides a simple way of adding metrics to your Synapse
|
||||||
installation, and serves under `/_synapse/metrics`. If you do not
|
installation, and serves under `/_synapse/metrics`. If you do not
|
||||||
@ -31,11 +33,13 @@
|
|||||||
|
|
||||||
Add a new listener to homeserver.yaml:
|
Add a new listener to homeserver.yaml:
|
||||||
|
|
||||||
|
```yaml
|
||||||
listeners:
|
listeners:
|
||||||
- type: metrics
|
- type: metrics
|
||||||
port: 9000
|
port: 9000
|
||||||
bind_addresses:
|
bind_addresses:
|
||||||
- '0.0.0.0'
|
- '0.0.0.0'
|
||||||
|
```
|
||||||
|
|
||||||
For both options, you will need to ensure that `enable_metrics` is
|
For both options, you will need to ensure that `enable_metrics` is
|
||||||
set to `True`.
|
set to `True`.
|
||||||
@ -47,10 +51,13 @@
|
|||||||
It needs to set the `metrics_path` to a non-default value (under
|
It needs to set the `metrics_path` to a non-default value (under
|
||||||
`scrape_configs`):
|
`scrape_configs`):
|
||||||
|
|
||||||
|
```yaml
|
||||||
- job_name: "synapse"
|
- job_name: "synapse"
|
||||||
|
scrape_interval: 15s
|
||||||
metrics_path: "/_synapse/metrics"
|
metrics_path: "/_synapse/metrics"
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ["my.server.here:port"]
|
- targets: ["my.server.here:port"]
|
||||||
|
```
|
||||||
|
|
||||||
where `my.server.here` is the IP address of Synapse, and `port` is
|
where `my.server.here` is the IP address of Synapse, and `port` is
|
||||||
the listener port configured with the `metrics` resource.
|
the listener port configured with the `metrics` resource.
|
||||||
@ -60,7 +67,8 @@
|
|||||||
|
|
||||||
1. Restart Prometheus.
|
1. Restart Prometheus.
|
||||||
|
|
||||||
1. Consider using the [grafana dashboard](https://github.com/matrix-org/synapse/tree/master/contrib/grafana/) and required [recording rules](https://github.com/matrix-org/synapse/tree/master/contrib/prometheus/)
|
1. Consider using the [grafana dashboard](https://github.com/matrix-org/synapse/tree/master/contrib/grafana/)
|
||||||
|
and required [recording rules](https://github.com/matrix-org/synapse/tree/master/contrib/prometheus/)
|
||||||
|
|
||||||
## Monitoring workers
|
## Monitoring workers
|
||||||
|
|
||||||
@ -87,6 +95,38 @@ don't clash with an existing worker.
|
|||||||
With this example, the worker's metrics would then be available
|
With this example, the worker's metrics would then be available
|
||||||
on `http://127.0.0.1:9101`.
|
on `http://127.0.0.1:9101`.
|
||||||
|
|
||||||
|
Example Prometheus target for Synapse with workers:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- job_name: "synapse"
|
||||||
|
scrape_interval: 15s
|
||||||
|
metrics_path: "/_synapse/metrics"
|
||||||
|
static_configs:
|
||||||
|
- targets: ["my.server.here:port"]
|
||||||
|
labels:
|
||||||
|
instance: "my.server"
|
||||||
|
job: "master"
|
||||||
|
index: 1
|
||||||
|
- targets: ["my.workerserver.here:port"]
|
||||||
|
labels:
|
||||||
|
instance: "my.server"
|
||||||
|
job: "generic_worker"
|
||||||
|
index: 1
|
||||||
|
- targets: ["my.workerserver.here:port"]
|
||||||
|
labels:
|
||||||
|
instance: "my.server"
|
||||||
|
job: "generic_worker"
|
||||||
|
index: 2
|
||||||
|
- targets: ["my.workerserver.here:port"]
|
||||||
|
labels:
|
||||||
|
instance: "my.server"
|
||||||
|
job: "media_repository"
|
||||||
|
index: 1
|
||||||
|
```
|
||||||
|
|
||||||
|
Labels (`instance`, `job`, `index`) can be defined as anything.
|
||||||
|
The labels are used to group graphs in grafana.
|
||||||
|
|
||||||
## Renaming of metrics & deprecation of old names in 1.2
|
## Renaming of metrics & deprecation of old names in 1.2
|
||||||
|
|
||||||
Synapse 1.2 updates the Prometheus metrics to match the naming
|
Synapse 1.2 updates the Prometheus metrics to match the naming
|
||||||
|
Loading…
Reference in New Issue
Block a user