Ben SchumacherandClaude Opus 5.5 353f76fe30 [MM-71101] Health Dashboard PR19: rules for database (#39021)
* [MM-71101] Add ConfigStrings snapshot accessor

ConfigStrings reads list settings such as DataSourceReplicas. It returns
ok=false when the config section is absent or any element is redacted, so a
redacted replica DSN cannot be read as a host name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* [MM-71101] Add database health rules

Ports the database checks from the health check script into a new
rules/database package: replica sizing, Trace, MaxOpenConns,
QueryTimeout, HA failover connection bursts (merged with the pooler
check), PostgreSQL version, pool saturation, unused replicas, IP-literal
DSN hosts, replica lag monitoring and MaxIdleConns above MaxOpenConns.

Rules that read DSNs only report derived facts; no DSN or host leaves
the rule.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* [MM-71101] Update health packet fixtures and expectations for database rules

The fixture configs gain the SqlSettings and ElasticsearchSettings keys a
real packet carries, and the HA fixture raises MaxOpenConns to 200 so the
golden set covers DB_HA_FAILOVER_STORM_RISK offline. The mmctl test packet
gains the database diagnostics and stats the rules read, and the parity
test expects DB_QUERY_TIMEOUT_HIGH from the test store's 60 s timeout.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* [MM-71101] Parse every DSN host and skip non-Postgres version checks

hostsFromDSN replaces hostFromDSN and returns every host a DSN names:
comma-separated host lists, host/hostaddr query parameters in URL form,
and hostaddr in keyword form. DB_CONNECTION_IS_IP fires when any host is
an IP; the failover rule treats a DSN as pooled when any host is a pooler.

DB_POSTGRES_UNSUPPORTED returns unknown when the diagnostics report a
database type other than Postgres, so older MySQL packets no longer
raise a Postgres version warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Raise DB_NO_SEARCH_REPLICA threshold to 2M posts

Matches the documented point where database search starts to degrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Remove DB_CONNECTION_IS_IP rule

An IP address in a DSN is correct for loopback, floating VIPs and k8s
services, and harmless on single-node installs, so the rule was mostly
noise. hostsFromDSN stays for the failover rule's pooler check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Remove DB_REPLICA_LAG_UNMONITORED rule

ReplicaLagSettings only feeds Prometheus gauges, and managed databases
already report replica lag, so the rule was an observability nudge with
nothing misconfigured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Simplify database health rules and tighten failover storm risk

- Drop Snapshot.ConfigStrings; its only caller now just counts entries.
- Parse only URL-form DSNs: sanitized config redacts every other form.
- DB_HA_FAILOVER_STORM_RISK counts only primary pools in the burst and
  treats loopback hosts and Unix sockets as a per-node pooler.
- DB_POOL_SATURATED checks the unlimited-pool gate before reading
  diagnostics.
- Share the minimum PostgreSQL version via model so sqlstore and
  DB_POSTGRES_UNSUPPORTED cannot drift apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Fire DB_HA_FAILOVER_STORM_RISK when any host bypasses the pooler

The driver tries a host list in order, so a direct host in the list can
take the full reconnection burst.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Skip DB_NO_SEARCH_REPLICA when database search is disabled

DB_POSTGRES_UNSUPPORTED now also reports unknown when the database type is missing.

* Base DB_REPLICA_UNUSED on replica online state

Open connection counts drop to zero on idle replica pools, so the rule now reads a new replicas_online support packet diagnostic.

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-19 09:44:44 +02:00
2026-10-04 12:35:53 +08:00
2018-05-30 10:23:25 -04:00

Mattermost logo

Mattermost is an open core, self-hosted collaboration platform that offers chat, workflow automation, voice calling, screen sharing, and AI integration. This repo is the primary source for core development on the Mattermost platform; it's written in Go and React, runs as a single Linux binary, and relies on PostgreSQL. A new compiled version is released under an MIT license every month on the 16th.

Deploy Mattermost on-premises, or try it for free in the cloud.

mattermost user interface

Learn more about the following use cases with Mattermost:

Other useful resources:

Table of contents

Install Mattermost

Other install guides:

Native mobile and desktop apps

In addition to the web interface, you can also download Mattermost clients for Android, iOS, Windows PC, macOS, and Linux.

Get Mattermost on Google Play Get Mattermost on the App Store Get Mattermost on Windows PC Get Mattermost on Mac OSX Get Mattermost on Linux

Get security bulletins

Receive notifications of critical security updates. The sophistication of online attackers is perpetually increasing. If you're deploying Mattermost it's highly recommended you subscribe to the Mattermost Security Bulletin mailing list for updates on critical security releases.

Subscribe here

Get involved

Learn more

License

See the LICENSE file for license rights and limitations.

Get the latest news

Contributing

Small Image

Please see CONTRIBUTING.md. Join the Mattermost Contributors server to join community discussions about contributions, development, and more.

S
Description
Mattermost is an open source platform for secure collaboration across the entire software development lifecycle..
Readme AGPL-3.0, Apache-2.0
2.6 GiB
0 Stars 3 Watchers 0 Forks
Languages
TypeScript 48.9%
Go 41.8%
JavaScript 5.1%
SCSS 2.3%
HTML 1.4%
Other 0.3%