Verified Commit 67d32f8e authored by Jan Alexander Steffens (heftig)'s avatar Jan Alexander Steffens (heftig)
Browse files

matrix: Export prometheus metrics

parent 128edca7
This diff is collapsed.
......@@ -41,3 +41,16 @@ matrix_nginx_config:
locations:
- "/_matrix"
- "/_synapse"
matrix_metrics_htpasswd: /etc/nginx/auth/matrix_metrics
matrix_metrics_endpoints:
- name: synapse.homeserver
port: 8019
- name: synapse.appservice
port: 8020
- name: synapse.federation_reader
port: 8021
- name: synapse.federation_writer
port: 8022
- name: synapse.media_repository
port: 8023
worker_name: appservice
worker_app: synapse.app.appservice
worker_listeners:
- port: 8020
type: metrics
bind_addresses: ['127.0.0.1']
# vim:ft=yaml sw=2 et:
......@@ -8,5 +8,8 @@ worker_listeners:
resources:
- names: [federation]
compress: false
- port: 8021
type: metrics
bind_addresses: ['127.0.0.1']
# vim:ft=yaml sw=2 et:
worker_name: federation_sender
worker_app: synapse.app.federation_sender
worker_listeners:
- port: 8022
type: metrics
bind_addresses: ['127.0.0.1']
# vim:ft=yaml sw=2 et:
......@@ -8,5 +8,8 @@ worker_listeners:
resources:
- names: [media]
compress: false
- port: 8023
type: metrics
bind_addresses: ['127.0.0.1']
# vim:ft=yaml sw=2 et:
......@@ -28,7 +28,7 @@
- pkgconf
- postgresql-libs
- python
- python2
- python-passlib
- redis
- tcl
- tk
......@@ -246,6 +246,15 @@
group: synapse
mode: 0640
- name: create htpasswd for matrix metrics endpoint
htpasswd:
path: "{{ matrix_metrics_htpasswd }}"
name: "{{ vault_matrix_secrets.metrics_user }}"
password: "{{ vault_matrix_secrets.metrics_password }}"
owner: root
group: http
mode: 0640
- name: make nginx log dir
file: path=/var/log/nginx/{{ matrix_domain }} state=directory owner=root group=root mode=0755
......
......@@ -312,6 +312,13 @@ listeners:
# module: my_module.CustomRequestHandler
# config: {}
# Turn on the twisted ssh manhole service on localhost on the given
# port.
#
#- port: 9000
# bind_addresses: ['::1', '127.0.0.1']
# type: manhole
- port: 9093
type: http
bind_addresses: ['::1', '127.0.0.1']
......@@ -319,12 +326,9 @@ listeners:
- names: [replication]
compress: false
# Turn on the twisted ssh manhole service on localhost on the given
# port.
#
#- port: 9000
# bind_addresses: ['::1', '127.0.0.1']
# type: manhole
- port: 8019
type: metrics
bind_addresses: ['127.0.0.1']
# Forward extremities can build up in a room due to networking delays between
# homeservers. Once this happens in a large room, calculation of the state of
......@@ -728,8 +732,8 @@ acme:
#
# By default, no domains are monitored in this way.
#
#federation_metrics_domains:
# - matrix.org
federation_metrics_domains:
- matrix.org
# - example.com
# Uncomment to disable profile lookup over federation. By default, the
......@@ -1482,7 +1486,7 @@ account_validity:
# Enable collection and rendering of performance metrics
#
#enable_metrics: false
enable_metrics: true
# Enable sentry integration
# NOTE: While attempts are made to ensure that the logs don't contain
......@@ -1502,7 +1506,7 @@ metrics_flags:
# servers this homeserver knows about, including itself. May cause
# performance problems on large homeservers.
#
#known_servers: true
known_servers: true
# Whether or not to report anonymized homeserver usage statistics.
#
......
......@@ -50,6 +50,22 @@ server {
{% endfor %}
{% endfor %}
location /metrics {
auth_basic "Matrix metrics";
auth_basic_user_file {{ matrix_metrics_htpasswd }};
{% for ep in matrix_metrics_endpoints %}
location = /metrics/{{ ep.name }} {
proxy_pass http://127.0.0.1:{{ ep.port }}/{{ ep.path | default('') }};
}
{% endfor %}
location = /metrics {
add_header Content-Type text/plain;
return 200 "Available endpoints:\n{% for ep in matrix_metrics_endpoints %} /metrics/{{ ep.name }}\n{% endfor %}";
}
}
location = / {
add_header Content-Type text/plain;
return 200 "Nothing to see here.";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment