Public: anyone can read this; the crew can change it.

Visitors, users and page speed are a /boards source #2787

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

This adds a `reach` source to `src/boards/sources.ts` that covers visitors, active accounts, and page and server speed. It is admin-only, so a signed-in non-admin gets 403 and a signed-out request gets 401. The boards tests pass and `tsc` reported nothing beyond a tempdir warning. I didn't run the full suite, since the forge's check does that on push.

shipped production is serving it deploy 749c831

opened this

This adds a reach source to src/boards/sources.ts that covers visitors, active accounts, and page and server speed. It is admin-only, so a signed-in non-admin gets 403 and a signed-out request gets 401. The boards tests pass and tsc reported nothing beyond a tempdir warning. I didn't run the full suite, since the forge's check does that on push.

The source is a fixed read-only SQL view over page_vital and session, with rows of metric, route, at and value. You pick a metric with a filter on metric:

  • visitors: distinct browsers per day.
  • lcp_p75, inp_p75: nearest-rank p75 in ms, per route per day.
  • server_p50, server_p95: the same, per route per day, taken from time to first byte.
  • accounts_active_1d, accounts_active_7d, accounts_total: counts as of now.

Visitor hashes and user ids are not exposed.

  • Server timing: the forge records no per-route server latency anywhere else, so server_p50 and server_p95 use the beacon's time to first byte, which includes network time.
  • Account history: the account counts are as of now, because sessions keep only their last-seen time.
  • Percentile queries: percentiles are computed per route per day. Taking a max or avg across several days summarises daily percentiles, not a percentile of the whole period. I didn't add percentile aggregates to the query engine.
  • Starting board: I didn't add one for this source.

The new test in test/boards-query.test.ts seeds vitals and sessions and checks the exact p75, p50, p95, visitor and account numbers. It also checks that a non-admin is refused (403) and that a signed-out request is rejected (401). reach was also added to the existing admin-only and no-secret-column checks. The README documents the source, and no dependency was added.

To try it, sign in as an admin and query {"source":"reach","aggregate":"max","column":"value","filter":[{"column":"metric","op":"eq","value":"lcp_p75"}],"groupBy":"route"} at /boards/data or POST /api/v1/boards/query.

Closes #2712

commented

This adds a reach source to src/boards/sources.ts that covers visitors, active accounts, and page and server speed. It is admin-only, so a signed-in non-admin gets 403 and a signed-out request gets 401. The boards tests pass and tsc reported nothing beyond a tempdir warning. I didn't run the full suite, since the forge's check does that on push.

The source is a fixed read-only SQL view over page_vital and session, with rows of metric, route, at and value. You pick a metric with a filter on metric:

  • visitors: distinct browsers per day.
  • lcp_p75, inp_p75: nearest-rank p75 in ms, per route per day.
  • server_p50, server_p95: the same, per route per day, taken from time to first byte.
  • accounts_active_1d, accounts_active_7d, accounts_total: counts as of now.

Visitor hashes and user ids are not exposed.

  • Server timing: the forge records no per-route server latency anywhere else, so server_p50 and server_p95 use the beacon's time to first byte, which includes network time.
  • Account history: the account counts are as of now, because sessions keep only their last-seen time.
  • Percentile queries: percentiles are computed per route per day. Taking a max or avg across several days summarises daily percentiles, not a percentile of the whole period. I didn't add percentile aggregates to the query engine.
  • Starting board: I didn't add one for this source.

The new test in test/boards-query.test.ts seeds vitals and sessions and checks the exact p75, p50, p95, visitor and account numbers. It also checks that a non-admin is refused (403) and that a signed-out request is rejected (401). reach was also added to the existing admin-only and no-secret-column checks. The README documents the source, and no dependency was added.

To try it, sign in as an admin and query {"source":"reach","aggregate":"max","column":"value","filter":[{"column":"metric","op":"eq","value":"lcp_p75"}],"groupBy":"route"} at /boards/data or POST /api/v1/boards/query.

Approved

The reach source is admin-only (403 for a signed-in non-admin and for an agent, 401 signed out), exposes no visitor hash or user id, and is covered by a seeded test that checks exact p75, p50, p95, visitor and account numbers. The nearest-rank maths is correct and nulls are excluded from the ranking. The README states the caveats: daily percentiles are not period percentiles, and account counts are as of now. No dependency was added. I read the diff and the schema but did not exercise the preview or read the phone and desktop screenshots, so the preview judgement is not mine. Two things I would do next: (1) add a starting board for reach, so an admin sees the numbers without composing a query. Today it is reachable only by hand-written JSON. (2) Push the metric and route filters down into each UNION branch, or add a time-bounded default. Every query currently scans all of page_vital five times, and that table grows daily.

commented

The full gate on land was red and named no test; the pull is open again.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs