Count the Active Session History drill-down's 30 days from the rollup
What does this MR do and why?
The Active Session History drill-down endpoint (active_session_history_queries) counted its 30 days back from a minute ago, while the summary counts them back from the newest minute rollup. After sampling has been off for over 30 days, the summary still shows the newest data, but the drill-down rejected the same window.
The drill-down now counts its 30 days back from the newest rollup too. It still doesn't end there, because raw samples are newer than the rollups.
Split from !262859 (merged). The queries drawer in !266416 (merged) is the first UI that reads this endpoint, so this one should merge first.
Database
The drill-down now also reads the newest rollup time, the same one-row read of ash.config that the summary already runs:
SELECT ash.ts_to_timestamptz(last_rollup_1m_ts) AS watermark FROM ash.config WHERE singletonReferences
- Work item: #608101
- Epic: gitlab-org#23091
How to set up and validate locally
In a Rails console:
report = Gitlab::Database::PgAsh::Report
newest = 31.days.ago.beginning_of_minute
from, to = (newest - 5.minutes).iso8601, newest.iso8601
report.window(report::DRILL_DOWN, from: from, to: to, newest_rollup: newest) # the five minutes
report.window(report::DRILL_DOWN, from: from, to: to) # raises InvalidWindowError, as beforeMR 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.