Monitoring Synapse with Prometheus and Grafana

Synapse exposes metrics that Prometheus can scrape and Grafana can chart, so you see federation, database and sync trouble before users report it. This page covers the setup, the options and the alerts to start with.

On this page

Why Synapse monitoring with Prometheus and Grafana matters before the first outage

Monitoring Synapse with Prometheus and Grafana gives you a view of your homeserver's health before users start reporting that messages are late or rooms will not load. Teams need this stack as soon as a Synapse homeserver carries real conversations, and especially once it federates with other servers, runs on PostgreSQL, or is split into workers. Synapse exposes metrics that show sync latency, federation traffic, database activity and event processing. Without collecting them over time, you have no baseline to compare against when something drifts, and the first sign of trouble is usually a user complaint.

Three components divide the work. Prometheus pulls metrics over HTTP from the main Synapse process and every worker, stores them as time series and evaluates alert rules against them. Grafana reads from Prometheus and draws the dashboards your operators use during an incident or a weekly review. Alertmanager receives the alerts Prometheus fires and handles grouping, silences and routing to the people on call. Prometheus is licensed under Apache-2.0 and has no paid enterprise edition of the project itself, so its cost is infrastructure, storage and the people who run it. Grafana is a separate project with its own licensing, and its commercial options are a separate decision you should confirm before you rely on any feature.

Before you install anything, decide who owns the stack, where it runs and how long you keep data. Prometheus local storage is not clustered or replicated, so it needs the same care as any single-node database, and its default retention is 15 days unless you change it. Confirm which Prometheus and Grafana release lines your organization will follow, since support windows differ by line. Ask your implementation partner, or your own platform team, to write down the alert destinations and the response expected for each one. A monitoring stack that is installed but not wired to a named responder will not catch the first outage early.

How to enable Synapse metrics and wire up the scrape targets

This sequence turns on Synapse's metrics listener, limits who can read it, and gives Prometheus a scrape job for the main process and each worker so every process shows up as a verified target.

  1. Confirm your Synapse version and config path

    The platform team checks which Synapse release runs on each host and locates the active homeserver.yaml, along with any worker configuration files. Metric names, listener options and worker settings can change between releases, so the exact keys should be confirmed in the Synapse configuration manual for that version before anything is edited. The step is done when the team has a written list of every Synapse process, its config file and its version.

  2. Enable the metrics listener on the main process

    An engineer adds a metrics listener to homeserver.yaml on the main process, using a dedicated port that is not used for client or federation traffic. The listener type and port keys should be copied from the configuration manual for the confirmed version, and the change is applied by restarting Synapse under your normal change process. The check is that Synapse starts cleanly in its logs and that the port is bound on the host.

  3. Restrict the metrics endpoint to the monitoring network

    The network team limits access to the metrics port so only the Prometheus servers can reach it, using host firewall rules, security groups or a private network segment. Metrics expose internal detail about traffic and state, so the endpoint should not be published through the reverse proxy or exposed on the federation listener. Confirm the restriction by requesting the endpoint from an approved monitoring host, which should succeed, and from an ordinary client network, which should fail.

  4. Expose metrics on each worker process

    For each worker in a Synapse worker deployment, the engineer enables a metrics listener on a distinct port in that worker's own configuration, following the workers documentation for your topology. Each process needs its own address and port so Prometheus can scrape it separately. The check is that every worker process logs a successful start and that its metrics port answers on the host where it runs, with the same network restriction applied.

  5. Add scrape jobs for the main process and workers

    The monitoring engineer adds a scrape job to the Prometheus configuration with one static target or service discovery entry per Synapse process, labeled so the main process and each worker type can be told apart in queries. Scrape intervals and any authentication settings should follow your Prometheus configuration and the Synapse documentation for the version in use. The job is ready when the configuration passes Prometheus's validation check and Prometheus reloads without errors.

  6. Check each worker appears as its own target

    The engineer opens the Targets page in the Prometheus web interface and confirms that the main process and every worker are listed under the Synapse job with a state of up. A missing worker usually means a wrong address, a closed firewall rule or a metrics listener that was not enabled. The step is complete when the target count matches the process inventory from the first step and each target shows recent scrape times.

  7. Run a test query for Synapse metrics

    Using the Prometheus expression browser, the engineer runs a simple PromQL query against a Synapse metric name taken from the metrics output of a live process, and confirms that series for each labeled process return values. This proves that data is stored and queryable, not only scraped. The check also confirms that the labels distinguish the main process from each worker, which the dashboards and alerts built later depend on.

  8. Record the configuration and access decisions

    The team saves the Synapse config changes, Prometheus scrape configuration, firewall rules and the list of approved monitoring hosts in version control or the change record, with the Synapse version they were tested against. Anyone upgrading Synapse later can then repeat the checks. The step is done when a colleague who was not involved can find the metrics port, the allowed sources and the target list without asking the original engineer.

How the main process, workers, Prometheus, Alertmanager and Grafana connect

The diagram starts with Synapse's main process and its workers, each exposing a metrics endpoint on the internal network. Prometheus pulls from every endpoint, and Redis carries replication between Synapse processes, separate from metrics. Prometheus sends firing alerts to every Alertmanager instance, and Grafana only queries Prometheus. The federation listener sits outside the metrics boundary and should be firewalled separately, so check that metrics ports never face the public internet.

Synapse metrics flow from every process to Prometheus, then to Alertmanager and Grafana.

Which monitoring options fit a single process, a worker deployment or a managed stack

A single-process Synapse homeserver exposes its metrics from one listener, so one Prometheus target covers the whole server. The setup is small: enable the metrics listener in the Synapse configuration, add one scrape job, and import a dashboard. Most of the effort goes into alert thresholds and retention, not into wiring.

  • One scrape target: the main process serves the metrics endpoint, and Prometheus pulls it on a fixed interval.
  • Local storage is enough for many teams: Prometheus keeps 15 days of data by default, which you can change by time or size.
  • Single-node Prometheus is a single point of failure: local storage is not clustered or replicated, so plan backups or remote write if history matters.
  • Grafana can run on the same host: for a small deployment, a single Grafana instance with SQLite is possible, but the Grafana install docs say SQLite is not for production.

Before you choose this path, confirm with your platform team how long metric history must be kept and whether a single monitoring host meets your availability expectations.

Importing the official Synapse dashboard and reading it

Import the Synapse dashboard into Grafana once Prometheus is scraping the main process and every worker, then read it panel by panel against the question each one answers. Confirm the current dashboard source, its download location and the exact panel names in the Synapse documentation for your version before you import, because panel titles and queries change between releases. Load the dashboard into the Grafana instance you already use for other services, and point its data source variable at the Prometheus instance that holds your Synapse metrics. Keep the dashboard under version control or provisioning so a later re-import does not silently replace your edits.

Read the federation send queue panels first, since they show whether outbound events to other servers are backing up. A growing queue for one destination usually points to a remote server that is unreachable or slow, while a queue across all destinations points to a problem on your side, such as outbound worker capacity. Next, check the database transaction time panels, which show how long Synapse waits on PostgreSQL. Sync latency panels show how quickly clients receive updates, and event persistence panels show how fast the writer processes persist new events. Read these together: slow persistence with normal database time points elsewhere, while slow transactions with normal persistence points at the database.

Adapt the dashboard variables before trusting any panel on a multi-worker deployment. Each worker exposes its own metrics, so the job and instance variables must include every worker type, not only the main process, or per-worker panels will look empty or misleading. Confirm the label names your scrape configuration produces, because the dashboard filters on them. Create a test panel that counts distinct instances per worker type to verify that every expected process appears, and review the dashboard again after you add or remove a worker.

Which alerts catch federation, database and sync problems early

How do I know when federation sends to other servers are backing up?

A growing send backlog or a rising rate of failed federation sends is the first sign that other servers are not receiving your events. The usual causes are a broken delegation or well-known file, a certificate that expired, port 8448 or 443 blocked at a firewall or reverse proxy, or a remote server that is down for a long time. Check the federation metrics for the affected destinations, then test reachability from outside your network using the federation tester on the Matrix side and your own curl checks against the well-known file. Set the alert threshold from your normal backlog over a few weeks, not from a generic number, because a busy server with many large rooms will always carry some queue. Read the Synapse federation docs before tuning, since port and delegation choices change what a healthy send looks like.

What does database transaction latency tell me about Synapse health?

Rising database transaction latency means PostgreSQL is taking longer to answer Synapse, which slows event persistence, sync and client requests across the whole server. Common causes include slow storage, a long-running vacuum or large purge, missing autovacuum tuning on busy tables, a backlog of state growth, or a query pattern pulled in by a new bridge or large room. Start with the Synapse database metrics and then check PostgreSQL itself for locks, long queries and disk I/O during the same window. Tune the alert to the latency your server shows on a normal day, because an absolute threshold copied from another deployment will fire during routine maintenance or stay silent during a real slowdown.

Why does connection pool saturation matter for Synapse?

Connection pool saturation means Synapse is using nearly all of the database connections it is allowed to open, so new requests queue and latency climbs even when PostgreSQL itself is healthy. The first check is whether the pool limit in your Synapse database configuration is too low for the number of workers you run, since each process holds its own pool. Next check for connection leaks or a spike in traffic from a single client, bridge or sync-heavy period. Confirm the PostgreSQL side has room for the total connections across all processes before raising any limit, and ask your team to review the figure against your worker count, because a higher limit without a database that can serve it only moves the queue.

How can I detect slow sync requests and growing worker lag?

Sync latency that rises while database latency stays flat usually points to a worker, a replication stream, or Redis falling behind rather than to the database. Worker lag means a process is consuming replicated events later than the main process produces them, so clients see stale timelines. Common causes are an overloaded generic worker, a stream writer under heavy event load, or a Redis instance with memory or network pressure. Check the replication and sync metrics for each worker before changing alert levels, and confirm every worker reports to the scrape job, since a missing worker can look like a quiet one. Thresholds should come from your own baseline across busy and quiet hours, as sync load on a school or enterprise server follows its own daily pattern.

What should trigger an alert when a Prometheus target is down?

A target-down alert fires when Prometheus cannot scrape a Synapse process, worker or exporter, and it is the alert that protects every other alert from silently going blind. The likely causes are a process that crashed or restarted, a metrics listener bound to the wrong address, a firewall or network policy change, or a changed port in the Synapse configuration. First check whether the process is running and whether its metrics endpoint responds locally, then check the scrape job status in Prometheus. Use a short evaluation window so a single missed scrape does not page anyone, but keep it short enough that a real outage is seen within minutes. Also alert on scrape failures for the Prometheus node itself, because a single-node Prometheus stores data locally and is not replicated.

How should I route Synapse alerts through Alertmanager?

Route alerts through Alertmanager so that related alerts arrive as one notification with grouping, inhibition and silences that your team controls. Group by the Synapse server name and alert family, so a federation outage and the target-down alert that caused it reach people as one incident. Use inhibition so that a target-down alert suppresses secondary latency alerts from the same process, and use silences for planned maintenance such as a Synapse upgrade or a PostgreSQL vacuum window. Record each silence with an owner and an end time. Prometheus should point at every Alertmanager instance, not at a load balancer in front of them, and if you run Alertmanager as a cluster, enable its --cluster flags as described in the Alertmanager docs.

Can I run more than one Prometheus server for Synapse, and how should I point them?

Yes, running two Prometheus servers that scrape the same targets is a common way to remove a single point of failure, but each server stores its own local data and is not clustered or replicated. Each Prometheus instance should send alerts to every Alertmanager instance directly, and Alertmanager deduplicates the alerts it receives. Confirm how your dashboards and alert rules query each instance, because a Grafana panel pointed at one Prometheus will show gaps when that server restarts. Ask your team to define retention and any remote write target for long-term storage before choosing this layout, since the design changes how much history survives an outage.

Securing the metrics endpoints and the monitoring stack

Metrics endpoints, dashboards and the scrape path all expose detail about your homeserver, its users and its traffic. The cards below cover where each listener sits, who can reach Grafana, and how the monitoring stack stays on supported releases so the controls you set today still hold after upgrades.

Expose Synapse metrics on an internal listener

Synapse serves metrics on a dedicated listener that you enable in its configuration. Bind it to a private interface or a loopback address that only the Prometheus host can reach, and do not publish it through the public reverse proxy. Check from outside your network that the metrics path returns nothing, and confirm the listener's bind address and port in your own configuration file before you open any firewall rule to the scraper.

Synapse configuration manual

Require authentication on Grafana metrics

Grafana's own metrics endpoint should not be anonymous. The security hardening guidance recommends requiring authentication for it, and the scrape job then needs a credential that Prometheus stores as a secret file. Treat that credential as a monitoring secret with its own rotation schedule. Confirm the endpoint returns an authentication error to an unauthenticated request after you change the setting.

Grafana hardening docs

Apply Grafana security hardening settings

Beyond the metrics endpoint, the hardening guide covers secure and SameSite cookies, a Content Security Policy, Trusted Types, hiding the Grafana version from unauthenticated users and domain verification against DNS rebinding. Apply them in your grafana.ini or environment overrides, then test login, dashboard embedding and alert notifications, because a strict policy can break panels or plugins that load external resources.

Firewall the federation listener

Synapse federation listens on port 8448 by default, and the configuration manual recommends firewalling that listener in addition to any allow list. Monitoring does not need it, so restrict inbound access to the federation port to the addresses other homeservers actually use, and keep the metrics listener and admin APIs off it. Verify the rules with a scan from a host outside the allowed set.

Control Grafana access through supported auth

Grafana supports LDAP, generic OAuth, Entra ID, Okta, GitHub, GitLab and Google OAuth, an auth proxy and JWT in every edition. SAML, team sync, active sync and SCIM provisioning are limited to Grafana Enterprise and Grafana Cloud. Decide which group mappings grant editor and admin roles before go-live, and confirm which features your edition supports before you plan around them.

Grafana authentication docs

Keep Prometheus and Grafana on supported releases

Prometheus minor releases receive bug fixes for about six weeks, so most teams should run the long-term support line, currently 3.13, which is supported until July 31, 2027. Grafana minor releases are supported for 9 months, and patch releases come at least monthly. Schedule a review each month, read the upgrade notes for both products, and retest your alert rules and dashboards after each change.

Prometheus release cycle

What monitoring Synapse costs and how much work it takes

What drives the cost of monitoring Synapse with Prometheus and Grafana?

The software is free, so cost comes from four places: the infrastructure that runs Prometheus, Alertmanager and Grafana, the storage that holds metrics, the implementation work to wire Synapse, its workers and the dashboards together, and the operator time to keep it running. Prometheus is licensed under Apache-2.0 and has no paid enterprise edition, and Grafana's self-hosted editions are also free to run. Costs rise with the number of Synapse processes and workers scraped, the number of series you keep, how long you retain data, and how many alerts need someone on call. Ask any partner to split its quote into one-time implementation work and recurring operator work, and to state which infrastructure it assumes you will pay for.

How long does it take to set up Synapse monitoring?

Duration depends mainly on how many processes you run and what monitoring stack already exists. A single Synapse process with an existing Prometheus and Grafana is a much smaller job than a multi-worker deployment that needs a scrape configuration for the main process and every worker, new Alertmanager routing, and a review of alert thresholds against real traffic. Worker count, Redis replication, reverse proxy metrics, and whether Grafana must be made highly available all add work. No fixed duration is set here. Ask a provider for a timeline tied to a written scope that lists the processes, the stack components and the alert set.

Can an internal team set up Synapse monitoring without a partner?

Yes, if the team already runs Prometheus or Grafana and has someone comfortable with PromQL, YAML configuration and Synapse's metrics settings. The work is mostly configuration, so an experienced platform engineer can often do it alone with the official Synapse documentation as the guide. The harder part is tuning alerts so they catch federation, database and sync problems without flooding the on-call rotation. Teams without prior Prometheus experience should plan time for learning, and they should decide in advance who owns the alerts after go-live, because that ownership is the recurring cost.

Is Grafana Cloud a good fit for monitoring Synapse?

Grafana Cloud can fit if you prefer a managed service and accept sending metrics outside your infrastructure. Per the Grafana pricing page, it has a free tier, a Pro tier that starts with a 19 US dollar monthly platform fee plus usage, and an Enterprise tier with a minimum commitment of 25,000 US dollars per year. Usage-based charges mean the bill grows with the number of active series and retained data, so the cost will track how many Synapse workers you expose. If your policy requires metrics to stay inside your own network, self-hosting Grafana is the better match. Confirm with your security and compliance teams where metrics may be stored before comparing bills.

How long should Synapse metrics be kept?

Prometheus keeps data for 15 days by default, and retention can be set by time or by size, according to the Prometheus storage documentation. Short retention suits operational alerting and recent troubleshooting, while longer history for capacity planning or incident reviews usually needs remote write to external long-term storage. Local storage is not clustered or replicated, so treat it like any single-node database with backups and disk planning. Set the retention period with your incident review and compliance requirements in mind, and confirm with your auditors whether any metrics count as records that must be kept for a set period.

What does a partner need from us to monitor Synapse?

A partner needs a current inventory of the Synapse deployment, including the Synapse version, the number of workers and their types, how Redis is deployed, the reverse proxy in front of the homeserver, and where the database runs. You should also provide access to the existing Prometheus, Alertmanager and Grafana instances or the decision to deploy new ones, the network paths that allow scraping of each worker's metrics listener, and the people who will receive alerts. Agree in writing who owns alert tuning after go-live, and confirm which metrics endpoints must require authentication before scraping begins.

How DeployOpen scopes and delivers Synapse monitoring

DeployOpen plans, builds and hands over Synapse metrics collection, Prometheus scraping and Grafana dashboards inside infrastructure you control. Each engagement starts from a written scope that names the Synapse processes, workers and alert routes covered, so your team knows exactly what it receives.

How we scope

  • Inventory the Synapse main process, each worker type, Redis and PostgreSQL to set the scrape targets
  • Agree which metrics endpoints are exposed, and which are restricted to your monitoring network
  • Confirm where Prometheus, Grafana and Alertmanager run, and who receives each alert
  • Record the retention period and storage size agreed for Prometheus data in the written scope

How we build

  • Enable Synapse metrics and scrape configuration for the main process and every worker
  • Import the official Synapse dashboard and adapt panels to your worker layout
  • Write alert rules for federation failures, database trouble and sync lag, then test each one
  • Provision data sources and dashboards as code so changes are reviewed and repeatable

How we hand over

  • Deliver a runbook explaining each alert, its likely cause and the first checks to run
  • Document Prometheus storage limits, retention settings and the owner of each Alertmanager receiver
  • Walk your operations team through dashboards, silences and how to add a new worker target
  • Provide the configuration files and a list of open items to confirm before go-live

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer
  • Retainers can cover Prometheus, Grafana and Alertmanager version upgrades on a planned schedule
  • Alert tuning follows real operating experience, with changes agreed and recorded in writing
  • Ask any provider to name who answers alerts out of hours and how escalation works

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.