feat(app): add faceted filters to the sessions page - #2992
Conversation
|
|
@vinzee is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
97076ea to
fa84b72
Compare
Greptile SummaryThe PR adds URL-persisted faceted filtering to the sessions page and applies those filters to correlated RUM trace aggregation.
Confidence Score: 3/5The PR is not yet safe to merge because service scoping can hide valid sessions and source changes can execute stale filters against a different trace schema. The service-discovery optimization still turns a partial session-source service set into a hard trace filter, including when independently retained trace data has no corresponding recording row, while source changes continue forwarding filters created for the prior trace source. Files Needing Attention: packages/app/src/sessions.ts and packages/app/src/SessionsPage.tsx
|
| Filename | Overview |
|---|---|
| packages/app/src/SessionsPage.tsx | Adds filter URL state, trace metadata resolution, the facet sidebar, active-filter pills, and filter forwarding into session queries. |
| packages/app/src/sessions.ts | Extends session aggregation with structured filters and a session-source-derived service-scope optimization. |
| packages/app/src/components/DBSearchPageFilters.tsx | Makes analysis controls optional and supports forcing exact facet discovery for the sessions view. |
| packages/app/src/components/SessionFilters.tsx | Provides a thin sessions-specific configuration of the shared facet sidebar. |
| packages/app/src/tests/sessions.test.ts | Covers service-scope SQL construction, escaping, and URL filter parsing. |
| packages/app/src/components/tests/SessionFilters.test.tsx | Verifies the sessions wrapper forces exact facets and hides inapplicable analysis controls. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
U[Sessions page controls] --> S[Selected session source]
S --> T[Correlated trace source]
U --> F[URL-persisted facet filters]
F --> Q[Session trace aggregation]
T --> Q
S --> D[Service-scope discovery]
D --> Q
Q --> L[Session card list]
Reviews (3): Last reviewed commit: "feat(app): add faceted filters to the se..." | Re-trigger Greptile
Deep ReviewFaceted-filter sidebar added to 🔴 P0/P1 — must fix
🟡 P2 — recommended
🔵 P3 nitpicks (3)
Reviewers (10): correctness, security, adversarial, performance, kieran-typescript, julik-frontend-races, testing, maintainability, previous-comments, project-standards. Testing gaps:
Verified as sound (no finding): |
fa84b72 to
d81257b
Compare
Bring the search page's faceted filter sidebar to /sessions and wire the selected filters into the session aggregation query. - Add a SessionFilters wrapper around DBSearchPageFilters that hides the analysis-mode tabs, denoise, and root-spans-only toggles that don't apply to sessions. - Persist sidebar filters in the URL and thread them through useSessions so they constrain the trace aggregation alongside the free-text query. Validate the ?filters= param against FilterSchema with a [] default so a stale/hand-edited param resolves to the default instead of white-screening. - Speed up the aggregation: resolve the RUM service name(s) from the session source and constrain the otel_traces scan by ServiceName, turning a ~100k-mark full scan into a small primary-key range. Enumerate those services over a window wider than the selected range so sessions that started just before the range aren't dropped, and on any failure or when no services resolve, fall back to the unscoped (still correct) scan. - Harden the ServiceName scope: escape ingested names with escapeSqlString (backslash then quote) in a dedicated buildServiceScopeFilters helper and build it inside the try/catch, so a crafted/backslash name can't inject into or break the aggregation. - Fix the empty filter sidebar: scope facet queries to RUM session spans via a rum.sessionId indexHint and force exact facet mode, so the 'show all values' path can't strip the scope and sample the whole trace table (which timed out and left the sidebar empty). - Portal the source-select dropdown so it renders above the filter sidebar instead of being clipped by its stacking context. - Add unit tests: SessionFilters prop forwarding, buildServiceScopeFilters escaping/fallback, and the ?filters= param validator. Co-authored-by: Cursor <cursoragent@cursor.com>
d81257b to
2b5bdd1
Compare
Summary
Bring the search page's faceted filter sidebar to /sessions and wire the selected filters into the session aggregation query.
Screenshots or video
The Sessions Tab now has a sidebar with filters:

How to test on Vercel preview
Preview routes: /sessions
Steps (/sessions):
References