perf(console): faster dashboard for organizations with thousands of monitors
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 11m12s
ci / test (pull_request) Successful in 12m47s
ci / build (pull_request) Canceled after 1m41s
ci / image (pull_request) Canceled after 0s

- The range picker no longer looks for the first result: on the real-time
  daily aggregate that aggregated the organization's recent raw results
  on every request. The oldest monitor's creation bounds the ranges now.
- Sorting worked out each row's key per comparison; it does so once now
  and moves each row once (40-60 ms to 5 ms for 3,500 monitors).
- The queries behind the monitor list run in parallel.
- The monitor API reads the latest results of the page's monitors only.
- The dashboard reports its steps in a Server-Timing header and logs
  them when it takes a second or more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-26 21:35:09 +01:00
1 parent af992409ef
commit ec33ef5c56
7 files changed
+145 -118

No files matched your search

+9 -1
View File
@@ -8,6 +8,7 @@ import (
"time"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
)
func TestTimeRangesAndSLA(t *testing.T) {
@@ -99,9 +100,16 @@ func TestRangeAvailabilityAndRegions(t *testing.T) {
id := uuid.MustParse(body["id"].(string))
org := uuid.MustParse(owner.orgID())
// Two hours of results: eu always fine, us always failing.
// Two hours of results: eu always fine, us always failing. (The
// monitor is as old as its results.)
ctx := context.Background()
now := time.Now()
if err := e.asSystem(t, func(tx pgx.Tx) error {
_, err := tx.Exec(ctx, `UPDATE monitors SET created_at = $1 WHERE id = $2`, now.Add(-121*time.Minute), id)
return err
}); err != nil {
t.Fatal(err)
}
checker := uuid.New()
for m := 0; m <= 120; m += 5 {
at := now.Add(-time.Duration(m) * time.Minute)