Skip to content

fix(pagespeed): show 30-day overview history - #3827

Open
Glazzze wants to merge 2 commits into
bluewave-labs:developfrom
Glazzze:fix/pagespeed-overview-30d
Open

fix(pagespeed): show 30-day overview history#3827
Glazzze wants to merge 2 commits into
bluewave-labs:developfrom
Glazzze:fix/pagespeed-overview-30d

Conversation

@Glazzze

@Glazzze Glazzze commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Load the past 30 days of PageSpeed history for the PageSpeed overview.
  • Aggregate PageSpeed checks into daily points per monitor to keep the overview response bounded.
  • Keep Uptime, Infrastructure, and PageSpeed detail-page behavior unchanged.

Fixes #3767

Testing

  • npm run lint
  • npm run format-check
  • npm run typeCheck
  • npm test -- --runInBand
    • 79 test suites passed
    • 1341 tests passed

Notes

The overview can display history retained in the checks collection. Checks removed by the configured retention policy cannot be restored.

Signed-off-by: Glazzze <2050408913@qq.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 08:16
@Glazzze
Glazzze requested a review from karenvicent as a code owner August 7, 2026 08:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the backend PageSpeed monitors “with-checks” response so the PageSpeed monitors overview page can render ~30 days of history without unbounded payload growth by returning daily-aggregated snapshots per monitor.

Changes:

  • Added IChecksRepository.findSnapshotsByMonitorIdsAndDateRange() and implemented it in MongoChecksRepository using an aggregation that groups PageSpeed checks by day.
  • Updated MonitorService.getMonitorsWithChecksByTeamId() to load 30-day PageSpeed history (daily snapshots) when requesting only type=pagespeed.
  • Added unit + integration test coverage for the new repository method and the new service behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
server/src/domain/monitors/monitor.service.ts Loads 30-day PageSpeed daily snapshots for the PageSpeed monitors overview response.
server/src/domain/checks/check.repository.mongo.ts Implements daily PageSpeed snapshot aggregation across monitor IDs.
server/src/domain/checks/check.repository.interface.ts Extends checks repository interface with the new snapshot query method.
server/test/unit/services/monitorService.test.ts Verifies PageSpeed overview requests call the new snapshot method and hydrate recentChecks.
server/test/integration/checksRepositoryGroupedChecks.test.ts Integration test for ordered, daily-aggregated PageSpeed snapshots.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +333 to +337
performance: { $avg: { $ifNull: ["$performance", 0] } },
accessibility: { $avg: { $ifNull: ["$accessibility", 0] } },
bestPractices: { $avg: { $ifNull: ["$bestPractices", 0] } },
seo: { $avg: { $ifNull: ["$seo", 0] } },
},
dateRange: DateRange,
options?: { type?: MonitorType }
): Promise<UptimeChecksResult | HardwareChecksResult | PageSpeedChecksResult>;
findSnapshotsByMonitorIdsAndDateRange(monitorIds: string[], dateRange: DateRange): Promise<Record<string, CheckSnapshot[]>>;
Signed-off-by: Glazzze <2050408913@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pagespeed overview: Default to 30 day window instead of 24 hours

2 participants