fix(pagespeed): show 30-day overview history - #3827
Open
Glazzze wants to merge 2 commits into
Open
Conversation
Signed-off-by: Glazzze <2050408913@qq.com>
There was a problem hiding this comment.
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 inMongoChecksRepositoryusing an aggregation that groups PageSpeed checks by day. - Updated
MonitorService.getMonitorsWithChecksByTeamId()to load 30-day PageSpeed history (daily snapshots) when requesting onlytype=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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3767
Testing
npm run lintnpm run format-checknpm run typeChecknpm test -- --runInBandNotes
The overview can display history retained in the
checkscollection. Checks removed by the configured retention policy cannot be restored.