No description
Find a file
Kumi 25c2887b5a
feat: Track local users by appservice ID
Introduces a new metric `synapse_local_users_appservice` to count local users by their associated appservice ID, enhancing the granularity of user analytics within the Synapse Prometheus exporter. This update involves modifications to the changelog and README to document the addition, and updates to the main Python script to implement the collection and reporting of this new metric.

The change aims to provide administrators and developers with better insights into appservice usage and user distribution, facilitating improved resource allocation and service optimization.
2024-05-18 12:05:05 +02:00
contrib feat: fork for Synapse metrics exporter 2024-05-18 11:56:47 +02:00
src/synapse_prometheus_exporter feat: Track local users by appservice ID 2024-05-18 12:05:05 +02:00
.gitignore feat: Enhance config flexibility and setup 2024-05-16 06:33:21 +02:00
CHANGELOG.md feat: Track local users by appservice ID 2024-05-18 12:05:05 +02:00
LICENSE feat: fork for Synapse metrics exporter 2024-05-18 11:56:47 +02:00
pyproject.toml feat: fork for Synapse metrics exporter 2024-05-18 11:56:47 +02:00
README.md feat: Track local users by appservice ID 2024-05-18 12:05:05 +02:00

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_local_users_appservice: Number of local users by appservice ID
  • synapse_total_devices: Total number of devices
  • synapse_total_rooms: Total number of rooms
  • synapse_total_events: Total number of events
  • synapse_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.