Skip to content

Connections Over Time plots a gauge and a cumulative counter on one axis #403

Description

@dpage

Description

client/src/components/Dashboard/ServerDashboard/PostgresOverviewSection.tsx:336
plots numbackends and sessions as two series on a single shared
axis. These are different kinds of quantity:

  • numbackends is a gauge — backends connected right now, bounded by
    max_connections, typically in the tens or low hundreds.

  • sessions is a cumulative counter — total sessions established
    since stats_reset, climbing into the thousands or millions.

On a shared axis the sessions staircase sets the scale and pins
numbackends to a flat line at the bottom. The legend labels them
"Backends" and "Sessions" as though they were comparable, inviting the
reader to conclude something like "40 backends and 85,000 sessions" as
if both were concurrent.

Proposed fix

Split into two charts.

Connections shows numbackends raw, with a max_connections
reference line. A stacked breakdown from pg_stat_activity covering
active, idle and idle-in-transaction would be a significant
improvement, since idle-in-transaction is where most real incidents
live.

Connection rate shows sessions_per_sec, which is new sessions per
second. This is currently invisible and is a strong signal on its own.

The diagnostic value is in the pair: a high session rate with a low
backend count means connection churn with no pooler, while
numbackends trending toward max_connections means exhaustion risk.

Related counting caveat

The pg_stat_database probe filters WHERE datname = current_database() (collector/src/probes/pg_stat_database_probe.go:66),
so summing numbackends across monitored databases undercounts the
server total. It misses unmonitored databases, and numbackends never
counts walsenders or autovacuum workers, which still consume
connection slots.

Either label the chart as per-database, or take the server-wide count
from pg_stat_activity.

Acceptance criteria

  • Two separate charts, each with correct units.

  • max_connections reference line on the connections chart.

  • Chart labelling makes the per-database scope explicit, or the count
    is sourced server-wide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions