Show the queries behind the Active Session History chart
What does this MR do and why?
Selecting a wait event type, or a point in the chart, shows the queries behind it in a drawer. From work item 608101.
The query cell becomes its own component, which the top queries table and the drawer share. The queries component gets a list layout for the drawer, and the JSON check moves to utils.
A second commit puts each sentence of two docs bullets from !262859 (merged) on its own line, a follow-up asked for there. It changes no wording.
Decisions
- Queries cover five minutes at a time. Only raw samples link a wait event type to its queries, and they are slow to read.
- On GDK, five minutes took 0.23-0.67 s at 25-1,000 active sessions, or about 2 s once PostgreSQL switches to a generic plan after five reads. The statement timeout is 4.5 s.
- GitLab.com's busiest main node peaked at 717 active sessions over 7 days in mid-October 2026.
- One raw read at a time, with no abort. Selections wait 250 ms after quick moves, and a new read waits for the one that is running. Aborting a read only frees the browser: the primary still finishes the scan, so aborting and reading again would stack scans there.
- The chart is selected with a pointer only. With a keyboard, select a wait event type in the table, then move through the time range with the drawer's arrows.
- No queries for a range read hourly. Hourly summaries have no minutes, so the chart and the wait event types can't be selected, and a note says why.
- The drawer overlays the chart, like other GitLab drawers such as the Kubernetes workload details. Recent minutes sit at the right of the chart, so the drawer often covers the minutes it marks until it closes.
Follow-ups
- Longer query windows, after GitLab vendors pg_ash 2.0-rc1 or later, which makes that read much faster (#636867).
- Raw sample retention: one day by default.
References
- Work item: #608101
- Epic: gitlab-org#23091
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
| State | Screenshot |
|---|---|
| Queries for a point in the chart, dark mode | ![]() |
| Range read hourly | ![]() |
| 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 and select Lock.
Queries need more than an hour of minute summaries, so turn sampling on at least 61 minutes before you test.
On GDK, sampling can take a while to start after Sidekiq boots. If no samples appear, take them by hand from the GDK directory:
while true; do gdk psql -d gitlabhq_development -c "select ash.take_sample()" > /dev/null; sleep 5; doneMR 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.




