Add support for exposing metrics for Synapse workers

This commit is contained in:
Slavi Pantaleev
2024-01-12 12:15:40 +02:00
parent 22f5f0ba75
commit 41a52945d6
11 changed files with 159 additions and 65 deletions

View File

@ -40,6 +40,20 @@
with_items: "{{ matrix_synapse_workers_current_systemd_services.files }}"
when: "not ansible_check_mode and (item.path | basename | replace('.service', '')) not in matrix_synapse_enabled_worker_names"
- name: Determine current worker label files
ansible.builtin.find:
path: "{{ matrix_synapse_base_path }}"
patterns: "worker.*.labels"
use_regex: true
register: matrix_synapse_workers_current_label_files
- name: Ensure unnecessary worker labels are cleaned
ansible.builtin.file:
path: "{{ item.path }}"
state: absent
with_items: "{{ matrix_synapse_workers_current_label_files.files }}"
when: "not ansible_check_mode and (item.path | basename | replace ('worker.', '') | replace('.labels', '')) not in matrix_synapse_enabled_worker_names"
- name: Ensure creation of worker systemd service files and configuration files
ansible.builtin.include_tasks: "{{ role_path }}/tasks/synapse/workers/util/setup_files_for_worker.yml"
with_items: "{{ matrix_synapse_workers_enabled_list }}"

View File

@ -4,6 +4,7 @@
matrix_synapse_worker_systemd_service_name: "{{ matrix_synapse_worker_details.name }}"
matrix_synapse_worker_container_name: "{{ matrix_synapse_worker_details.name }}"
matrix_synapse_worker_config_file_name: "worker.{{ matrix_synapse_worker_details.name }}.yaml"
matrix_synapse_worker_labels_file_name: "worker.{{ matrix_synapse_worker_details.name }}.labels"
- name: Ensure configuration exists for {{ matrix_synapse_worker_systemd_service_name }}
ansible.builtin.template:
@ -13,6 +14,14 @@
owner: "{{ matrix_synapse_uid }}"
group: "{{ matrix_synapse_gid }}"
- name: Ensure labels exists for {{ matrix_synapse_worker_systemd_service_name }}
ansible.builtin.template:
src: "{{ role_path }}/templates/synapse/worker-labels.j2"
dest: "{{ matrix_synapse_base_path }}/{{ matrix_synapse_worker_labels_file_name }}"
mode: 0644
owner: "{{ matrix_synapse_uid }}"
group: "{{ matrix_synapse_gid }}"
- name: Ensure systemd service exists for {{ matrix_synapse_worker_systemd_service_name }}
ansible.builtin.template:
src: "{{ role_path }}/templates/synapse/systemd/matrix-synapse-worker.service.j2"