Skip to content

feat: better filters - #504

Merged
sergiofilhowz merged 1 commit into
mainfrom
feat/trace-filter
Jul 15, 2026
Merged

feat: better filters#504
sergiofilhowz merged 1 commit into
mainfrom
feat/trace-filter

Conversation

@sergiofilhowz

@sergiofilhowz sergiofilhowz commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Trace lists now reflect active span filters, hiding traces without matching visible spans.
    • Timeline span visibility rules are applied consistently across the timeline and trace list.
    • Pagination, counts, loading states, and empty states now reflect filtered results.
  • Bug Fixes

    • Improved handling of hidden roots, workers, internal spans, and truncated trace data.
    • Preserved trace visibility while additional span information is being loaded.
  • Tests

    • Added comprehensive coverage for filtering, visibility updates, caching, and fetched trace data.

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview, Comment Jul 15, 2026 5:52pm
workers-tech-spec Ready Ready Preview, Comment Jul 15, 2026 5:52pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 42 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Traces V2 now shares span-hidden logic between timeline rendering and trace-list filtering. A new hook derives visibility verdicts from feed and fetched spans, while pagination, statistics, and empty states use the filtered trace set.

Changes

Span filter visibility

Layer / File(s) Summary
Shared span visibility predicate
console/web/src/pages/TracesV2/components/timeline/spanVisibility.ts, console/web/src/pages/TracesV2/components/timeline/TimelineStrip.tsx, console/web/src/pages/TracesV2/lib/timelineSpans.ts
Shared keys and hidden-state rules now drive timeline pruning, reparenting, and span grouping.
Trace visibility verdicts
console/web/src/pages/TracesV2/hooks/useSpanFilteredTraceRows.ts, console/web/src/pages/TracesV2/hooks/useSpanFilteredTraceRows.test.ts
The new hook reconciles feed spans, cached verdicts, and fetched spans while excluding engine internals; tests cover filtering, truncation, caching, and reveal behavior.
Filtered list integration
console/web/src/pages/TracesV2/index.tsx
Pagination, statistics, loading, and empty-state rendering now use span-filtered trace rows.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TracesV2
  participant useSpanFilteredTraceRows
  participant reconcileTraceVisibility
  participant mergeFetchedVerdicts
  TracesV2->>useSpanFilteredTraceRows: rows, feed spans, selection
  useSpanFilteredTraceRows->>reconcileTraceVisibility: reconcile feed-based verdicts
  useSpanFilteredTraceRows->>mergeFetchedVerdicts: merge fetched span verdicts
  mergeFetchedVerdicts-->>useSpanFilteredTraceRows: updated verdict map
  useSpanFilteredTraceRows-->>TracesV2: visible trace rows
Loading

Possibly related PRs

  • iii-hq/workers#487: Refactors span visibility handling that this change reuses for trace-list filtering.

Poem

I’m a rabbit with spans in my paws,
Hiding bars by the filter laws.
Roots and workers hop into line,
Cached verdicts keep traces fine.
“Unknown” finds its gateway home—
Filtered rows now neatly roam!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 68.75% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is generic and doesn’t describe the specific trace/filtering changes in this PR. Rename it to mention the main change, such as span-filtered trace rows or timeline visibility filtering.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/trace-filter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
console/web/src/pages/TracesV2/hooks/useSpanFilteredTraceRows.ts (1)

145-154: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoff

Duplicate span→bar mapping on the live-streaming hot path.

verdictBars re-runs storedSpansToTimelineSpans(feedSpans) independently of TimelineStrip's own equivalent mapping over the same StoredSpan[] (TimelineStrip.tsx's allSpans memo). Since feedSpans/allSpans changes frequently while streaming, this doubles the O(n) span-mapping cost every time new spans arrive. Consider lifting the shared TimelineSpan[] mapping up to index.tsx and passing it to both TimelineStrip and this hook (filtering builtins from the already-computed bars) instead of recomputing from raw spans twice.

Also applies to: 184-193

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@console/web/src/pages/TracesV2/hooks/useSpanFilteredTraceRows.ts` around
lines 145 - 154, Eliminate the duplicate span-to-bar conversion between
verdictBars and TimelineStrip by lifting the storedSpansToTimelineSpans mapping
into the shared index.tsx flow. Pass the computed TimelineSpan[] to both
TimelineStrip and useSpanFilteredTraceRows, and update verdictBars to filter
engine builtins from those precomputed bars rather than remapping raw
StoredSpan[].
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@console/web/src/pages/TracesV2/hooks/useSpanFilteredTraceRows.ts`:
- Around line 145-154: Eliminate the duplicate span-to-bar conversion between
verdictBars and TimelineStrip by lifting the storedSpansToTimelineSpans mapping
into the shared index.tsx flow. Pass the computed TimelineSpan[] to both
TimelineStrip and useSpanFilteredTraceRows, and update verdictBars to filter
engine builtins from those precomputed bars rather than remapping raw
StoredSpan[].

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a7f0dfcd-296b-477b-ba9a-f7eba82587b8

📥 Commits

Reviewing files that changed from the base of the PR and between 2f501d2 and 70ce10a.

📒 Files selected for processing (6)
  • console/web/src/pages/TracesV2/components/timeline/TimelineStrip.tsx
  • console/web/src/pages/TracesV2/components/timeline/spanVisibility.ts
  • console/web/src/pages/TracesV2/hooks/useSpanFilteredTraceRows.test.ts
  • console/web/src/pages/TracesV2/hooks/useSpanFilteredTraceRows.ts
  • console/web/src/pages/TracesV2/index.tsx
  • console/web/src/pages/TracesV2/lib/timelineSpans.ts

@sergiofilhowz
sergiofilhowz merged commit 946e27a into main Jul 15, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant