You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/metrics-howto.md
+57-17Lines changed: 57 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,12 @@
13
13
can be enabled by adding the \"metrics\" resource to the existing
14
14
listener as such:
15
15
16
-
resources:
17
-
- names:
18
-
- client
19
-
- metrics
16
+
```yaml
17
+
resources:
18
+
- names:
19
+
- client
20
+
- metrics
21
+
```
20
22
21
23
This provides a simple way of adding metrics to your Synapse
22
24
installation, and serves under `/_synapse/metrics`. If you do not
@@ -31,11 +33,13 @@
31
33
32
34
Add a new listener to homeserver.yaml:
33
35
34
-
listeners:
35
-
- type: metrics
36
-
port: 9000
37
-
bind_addresses:
38
-
- '0.0.0.0'
36
+
```yaml
37
+
listeners:
38
+
- type: metrics
39
+
port: 9000
40
+
bind_addresses:
41
+
- '0.0.0.0'
42
+
```
39
43
40
44
For both options, you will need to ensure that `enable_metrics` is
41
45
set to `True`.
@@ -47,10 +51,13 @@
47
51
It needs to set the `metrics_path` to a non-default value (under
48
52
`scrape_configs`):
49
53
50
-
- job_name: "synapse"
51
-
metrics_path: "/_synapse/metrics"
52
-
static_configs:
53
-
- targets: ["my.server.here:port"]
54
+
```yaml
55
+
- job_name: "synapse"
56
+
scrape_interval: 15s
57
+
metrics_path: "/_synapse/metrics"
58
+
static_configs:
59
+
- targets: ["my.server.here:port"]
60
+
```
54
61
55
62
where `my.server.here` is the IP address of Synapse, and `port` is
56
63
the listener port configured with the `metrics` resource.
@@ -60,7 +67,8 @@
60
67
61
68
1. Restart Prometheus.
62
69
63
-
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/)
70
+
1. Consider using the [grafana dashboard](https://github.com/matrix-org/synapse/tree/master/contrib/grafana/)
71
+
and required [recording rules](https://github.com/matrix-org/synapse/tree/master/contrib/prometheus/)
64
72
65
73
## Monitoring workers
66
74
@@ -76,9 +84,9 @@ To allow collecting metrics from a worker, you need to add a
76
84
under `worker_listeners`:
77
85
78
86
```yaml
79
-
- type: metrics
80
-
bind_address: ''
81
-
port: 9101
87
+
- type: metrics
88
+
bind_address: ''
89
+
port: 9101
82
90
```
83
91
84
92
The `bind_address` and `port` parameters should be set so that
@@ -87,6 +95,38 @@ don't clash with an existing worker.
87
95
With this example, the worker's metrics would then be available
88
96
on `http://127.0.0.1:9101`.
89
97
98
+
Example Prometheus target for Synapse with workers:
99
+
100
+
```yaml
101
+
- job_name: "synapse"
102
+
scrape_interval: 15s
103
+
metrics_path: "/_synapse/metrics"
104
+
static_configs:
105
+
- targets: ["my.server.here:port"]
106
+
labels:
107
+
instance: "my.server"
108
+
job: "master"
109
+
index: 1
110
+
- targets: ["my.workerserver.here:port"]
111
+
labels:
112
+
instance: "my.server"
113
+
job: "generic_worker"
114
+
index: 1
115
+
- targets: ["my.workerserver.here:port"]
116
+
labels:
117
+
instance: "my.server"
118
+
job: "generic_worker"
119
+
index: 2
120
+
- targets: ["my.workerserver.here:port"]
121
+
labels:
122
+
instance: "my.server"
123
+
job: "media_repository"
124
+
index: 1
125
+
```
126
+
127
+
Labels (`instance`, `job`, `index`) can be defined as anything.
128
+
The labels are used to group graphs in grafana.
129
+
90
130
## Renaming of metrics & deprecation of old names in 1.2
91
131
92
132
Synapse 1.2 updates the Prometheus metrics to match the naming
0 commit comments