Refactored the project from a PostgreSQL connection metrics exporter to a Synapse metrics exporter. This change addresses the need for more specific metrics related to Synapse Matrix servers, instead of the general PostgreSQL connection metrics. Updated the project name, relevant variable names, and configurations to reflect the Synapse focus. Now, the exporter provides metrics such as local users by state, type, and moderation status, total devices, rooms, events, and federation destinations. This update shifts the project's direction to support Synapse server administrators by offering detailed insights into their server's usage and performance. No existing functionality was removed; instead, the project's aim was realigned to meet the more specialized requirements of Synapse metrics reporting. By focusing on Synapse, the exporter can offer valuable data that was not previously available through the general PostgreSQL connection metrics, potentially contributing to improved server management and user experience on the Synapse platform.
2 KiB
Synapse Exporter for Prometheus
This is an exporter for Prometheus that collects metrics from a Synapse PostgreSQL database. SQLite is not supported.
It is designed to be used with the Synapse Matrix server and provides some additional metrics that are not exported by the internal Prometheus exporter.
Metrics
The exporter currently provides the following metrics:
synapse_local_users_state
: Number of local users by state (active, disabled)synapse_local_users_type
: Number of local users by type (guest, user, appservice)synapse_local_users_moderation
: Number of local users by moderation status (active, shadow_banned, locked)synapse_total_devices
: Total number of devicessynapse_total_rooms
: Total number of roomssynapse_total_events
: Total number of eventssynapse_federation_destinations
: Number of federation destinations (i.e. federated servers)
Installation
You can install the exporter from PyPI. Within a virtual environment, run:
pip install synapse-prometheus-exporter
Configuration
The exporter is configured using a config.yaml
. You can create a default configuration file in the current working directory with:
synapse-prometheus-exporter --create-config
Now, edit the config.yaml
file to match your PostgreSQL connection settings. Here is an example configuration:
hosts:
- host: localhost
port: 5432
user: postgres
password: postgres
database: synapse
Usage
After you have created your config.yaml
, you can start the exporter with:
synapse-prometheus-exporter
By default, the exporter listens on localhost:8999
. You can change the address in the config.yaml
file, or using the --host
and --port
flags:
synapse-prometheus-exporter --host 0.0.0.0 --port 9899
You can also specify a different configuration file with the --config
flag:
synapse-prometheus-exporter --config /path/to/config.yaml
License
This project is licensed under the MIT License. See the LICENSE file for details.