Add a database load chart to Active Session History

What does this MR do and why?

Adds a database load chart to the Active session history tab from work item 608101. It shows average active sessions per minute, stacked by wait event type.

This MR used to include the queries behind the chart too. They are now in !266416 (merged), stacked on this one, with a backend fix they need in !266415 (merged).

Decisions

  • One-minute points for every range. 15 GitLab.com database incidents from 2025-2026 each lasted six minutes or more, and 15-minute points flattened them. A day is 1,440 points per wait event type: about 5 KB gzipped, and 5-6 ms to read.
  • Hourly fallback. A range that starts before pg_ash's oldest minute summary is read hourly, so the chart shows hours.
  • Idle minutes show as no load. pg_ash stores no samples while no session is active, so a minute without samples counts as zero, as in pg_ash's own averages and its ash.chart(). Gaps hid a busy minute between two idle ones. pg_ash can't tell idle time from a sampling stop, and the docs say so. An hour without a summary, such as the current one, stays a gap.
  • One timeline request per wait event type, at most 20, sent in parallel when the range changes. Each reads minute summaries in a few milliseconds.
  • The y-axis reaches at least one session. Auto-scaling drew an idle database at 0.03 sessions as tall as an incident at 26. Loads of one session or more scale as before, like a Grafana soft max.

Follow-ups

  • A per-minute peak line, which would show bursts shorter than a minute.

References

Screenshots or screen recordings

Before After
Active session history tab without the chart Database load chart
State Screenshot
Range read hourly Hourly chart
Narrow screen, dark mode Narrow screen

How to set up and validate locally

Set up as in MR 262713, make some lock waits, then open the Active session history tab.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Imanpal Singh

Merge request reports

Loading
Loading