fix(metrics): align hourly query lower bound to start of UTC hour

hourlySince used now-23h (partial first bucket, undercounting the oldest
hourly point). Align to start of current UTC hour like loadHourlyUsers and
the chart bucket loop so all 24 buckets are full and keys line up.
This commit is contained in:
mantrakp04 2026-06-01 13:56:36 -07:00
parent f77f775917
commit 9dfab510dc

View File

@ -1425,7 +1425,11 @@ async function loadAnalyticsOverview(
ORDER BY hour ASC
`,
query_params: {
hourlySince: formatClickhouseDateTimeParam(new Date(now.getTime() - 23 * 60 * 60 * 1000)),
hourlySince: formatClickhouseDateTimeParam((() => {
const latestHour = new Date(now);
latestHour.setUTCMinutes(0, 0, 0);
return new Date(latestHour.getTime() - 23 * 60 * 60 * 1000);
})()),
since: formatClickhouseDateTimeParam(since),
untilExclusive: formatClickhouseDateTimeParam(untilExclusive),
projectId: tenancy.project.id,