feat(app): add faceted filters to the sessions page - #2992
Conversation
🦋 Changeset detectedLatest commit: 1901232 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@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 a sessions-specific faceted-filter sidebar, persists selected filters in the URL, and applies them to RUM session aggregation.
Confidence Score: 3/5The PR is not yet safe to merge because service scoping can hide valid sessions and source changes can apply stale filters to the newly selected source. The trace aggregation still treats a successful but incomplete session-derived service list as authoritative, while the source-switch path preserves filters generated for the previous trace schema; both paths can return missing or incorrect session results. Files Needing Attention: packages/app/src/sessions.ts, packages/app/src/SessionsPage.tsx
|
| Filename | Overview |
|---|---|
| packages/app/src/SessionsPage.tsx | Adds URL-backed facet state and the sessions sidebar, but source changes still carry filters from the previously selected trace source. |
| packages/app/src/sessions.ts | Applies faceted filters and a service-scope optimization to session aggregation, while the optimization can still exclude valid trace-derived sessions when its lookup is partially incomplete. |
| packages/app/src/components/DBSearchPageFilters.tsx | Adds optional presentation and exact-facet-mode controls used by the sessions wrapper. |
| packages/app/src/components/SessionFilters.tsx | Provides a thin sessions-specific configuration of the shared faceted-filter sidebar. |
| packages/app/src/tests/sessions.test.ts | Covers filter URL validation and service-scope serialization, but not the outstanding partial-scope behavior. |
| packages/app/src/components/tests/SessionFilters.test.tsx | Verifies that the sessions wrapper forces the intended sidebar options. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
User[Session filters] --> URL[URL and form filter state]
URL --> Page[SessionsPage]
Page --> Facets[Session facet query]
Page --> Hook[useSessions]
SessionSource[Session source service lookup] --> Scope[ServiceName scope]
Scope --> Hook
Hook --> TraceQuery[RUM trace aggregation]
TraceQuery --> Results[Session cards]
Reviews (4): Last reviewed commit: "feat(app): add faceted filters to the se..." | Re-trigger Greptile
Deep ReviewFaceted filters for 🔴 P0/P1 -- must fix
🟡 P2 -- recommended
🔵 P3 nitpicks (3)
Reviewers (8): correctness, security, performance, testing, maintainability, kieran-typescript, adversarial, previous-comments. Testing gaps:
|
fa84b72 to
d81257b
Compare
d81257b to
2b5bdd1
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>
2b5bdd1 to
1901232
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