synapse workers: define and expose METRICS port for each worker

As seen on TV:
https://github.com/matrix-org/synapse/blob/master/docs/metrics-howto.md#monitoring-workers
development
Marcel Partap 4 years ago
parent af08f18779
commit f201bca519

@ -281,19 +281,19 @@ matrix_synapse_workers_enabled: false
# - no endpoints / doesn't need port mapping if port ends on 0 # - no endpoints / doesn't need port mapping if port ends on 0
# - single-instance-only if 2nd last digit of port number is 0 # - single-instance-only if 2nd last digit of port number is 0
matrix_synapse_workers_enabled_list: matrix_synapse_workers_enabled_list:
- { type: generic_worker, port: 18111 } - { type: generic_worker, port: 18111, metrics_port: 19111 }
- { type: generic_worker, port: 18112 } - { type: generic_worker, port: 18112, metrics_port: 19112 }
- { type: generic_worker, port: 18113 } - { type: generic_worker, port: 18113, metrics_port: 19113 }
- { type: generic_worker, port: 18114 } - { type: generic_worker, port: 18114, metrics_port: 19114 }
- { type: generic_worker, port: 18115 } - { type: generic_worker, port: 18115, metrics_port: 19115 }
- { type: generic_worker, port: 18116 } - { type: generic_worker, port: 18116, metrics_port: 19116 }
- { type: pusher, port: 00 } - { type: pusher, port: 00, metrics_port: 19200 }
- { type: appservice, port: 00 } - { type: appservice, port: 00, metrics_port: 19300 }
- { type: federation_sender, port: 0 } - { type: federation_sender, port: 0, metrics_port: 19400 }
- { type: media_repository, port: 18221 } - { type: media_repository, port: 18551, metrics_port: 19551 }
# disable until https://github.com/matrix-org/synapse/issues/8787 resolved # disable until https://github.com/matrix-org/synapse/issues/8787 resolved
# - { type: user_dir, port: 18331 } # - { type: user_dir, port: 18661, metrics_port: 19661 }
- { type: frontend_proxy, port: 18441 } - { type: frontend_proxy, port: 18771, metrics_port: 19771 }
# Redis information # Redis information
matrix_synapse_redis_enabled: false matrix_synapse_redis_enabled: false

@ -43,14 +43,18 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-synapse \
{% if matrix_synapse_manhole_enabled and matrix_synapse_container_manhole_api_host_bind_port %} {% if matrix_synapse_manhole_enabled and matrix_synapse_container_manhole_api_host_bind_port %}
-p {{ matrix_synapse_container_manhole_api_host_bind_port }}:9000 \ -p {{ matrix_synapse_container_manhole_api_host_bind_port }}:9000 \
{% endif %} {% endif %}
{% if matrix_synapse_workers_enabled and not matrix_nginx_proxy_enabled|default(False) %}
{# Expose worker (by default 18xxx range) ports on host if not using internal nginx proxy #}
{% for worker in matrix_synapse_workers_enabled_list %} {% for worker in matrix_synapse_workers_enabled_list %}
{% if matrix_synapse_workers_enabled and not matrix_nginx_proxy_enabled|default(False) %}
{# Expose worker ports (by default 18xxx range) on host if not using internal nginx proxy #}
{% if worker.port != 0 %} {% if worker.port != 0 %}
-p {{ worker.port }}:{{ worker.port }} \ -p {{ worker.port }}:{{ worker.port }} \
{% endif %} {% endif %}
{% endfor %}
{% endif %} {% endif %}
{# Expose worker metrics ports on host if defined #}
{% if worker.metrics_port != 0 %}
-p {{ worker.metrics_port }}:{{ worker.metrics_port }} \
{% endif %}
{% endfor %}
--mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/data,ro \ --mount type=bind,src={{ matrix_synapse_config_dir_path }},dst=/data,ro \
--mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \ --mount type=bind,src={{ matrix_synapse_storage_path }},dst=/matrix-media-store-parent,bind-propagation=slave \
{% for volume in matrix_synapse_container_additional_volumes %} {% for volume in matrix_synapse_container_additional_volumes %}

@ -21,6 +21,10 @@ worker_listeners:
{% endif %} {% endif %}
{% endif %} {% endif %}
- type: metrics
bind_address: ''
port: {{ item.metrics_port }}
{% if item.type == 'frontend_proxy' %} {% if item.type == 'frontend_proxy' %}
worker_main_http_uri: http://127.0.0.1:8008 worker_main_http_uri: http://127.0.0.1:8008
{% endif %} {% endif %}

Loading…
Cancel
Save