Skip to content

feat(nvtx): add context server routes - #563

Merged
rapids-bot[bot] merged 6 commits into
rapidsai:mainfrom
9prady9:pr/nvtx-server-routes
Aug 13, 2026
Merged

feat(nvtx): add context server routes#563
rapids-bot[bot] merged 6 commits into
rapidsai:mainfrom
9prady9:pr/nvtx-server-routes

Conversation

@9prady9

@9prady9 9prady9 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add context-scoped NVTX catalog and viewport endpoints to the query-engine server
  • discover the contexts associated with each engine and expose their resource ownership
  • cache reconstructed NVTX models and query-relative catalogs for efficient viewport requests
  • run telemetry processing on a bounded blocking pool and validate request size and filter limits

The routes use the viewport contracts introduced in #562. A required query_start parameter establishes the time origin for catalog and viewport responses.

Verification

  • pixi run cargo test -p nvtx-server -p quent-query-engine-server
  • pixi run cargo clippy -p nvtx-server -p quent-query-engine-server --all-targets -- -D warnings
  • cargo fmt --all -- --check

@9prady9
9prady9 force-pushed the pr/nvtx-server-routes branch from 28ab44a to e072060 Compare August 12, 2026 02:07
@9prady9
9prady9 marked this pull request as ready for review August 12, 2026 08:49
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: 07bc1068-4da4-40a3-a6e5-6353d7d8ad21

📥 Commits

Reviewing files that changed from the base of the PR and between 169183b and a7bb36b.

📒 Files selected for processing (2)
  • crates/io/src/filesystem/mod.rs
  • integrations/nvtx/server/src/lib.rs

📝 Walkthrough

Walkthrough

The query-engine server now reports engine context resources and merges integration routes. A new NVTX server imports event streams, reconstructs and caches models, and exposes catalog and viewport endpoints with validation and error handling.

Changes

Engine context ownership and query routing

Layer / File(s) Summary
Context ownership contract and cache
domains/query_engine/ui/src/lib.rs, domains/query_engine/server/src/analyzer_cache.rs
Adds EngineContexts and records ordered, deduplicated resource ownership for engine contexts.
Query-engine routing and context endpoint
domains/query_engine/server/src/lib.rs, domains/query_engine/server/src/ui.rs
Adds integration route merging and GET /api/engines/{engine_id}/contexts.

NVTX server

Layer / File(s) Summary
NVTX package and cached model loading
Cargo.toml, integrations/nvtx/server/Cargo.toml, integrations/nvtx/server/src/lib.rs, crates/io/src/filesystem/mod.rs
Adds the workspace crate, context-wide format detection, filesystem import behavior, bounded model caching, origin-specific catalogs, and blocking reconstruction.
NVTX HTTP API and validation
integrations/nvtx/server/src/lib.rs
Adds catalog and viewport routes, request limits, sanitized errors, and coverage for caching, validation, stream states, concurrency, and failure isolation.

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

Mergeability Score: ⚪ Minimal · up to a7bb3

The PR adds context-scoped NVTX catalog and viewport routes with request limits and caching; no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

Suggested labels: feature request, non-breaking

Suggested reviewers: dhruv9vats, mbrobbel, johanpel, felipeblazing, cmatzenbach

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 61.90% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: adding NVTX context server routes.
Description check ✅ Passed The description explains the main changes and lists verification commands, but it omits the template headings for related issues and screenshots.
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 unit tests (beta)
  • Create PR with unit tests

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.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@domains/query_engine/server/src/analyzer_cache.rs`:
- Around line 235-241: Make AnalyzerCache::contexts asynchronous and execute
self.lister inside tokio::task::spawn_blocking, propagating join and lister
errors consistently with list_with_metadata and get. Update engine_contexts to
await contexts while preserving the existing EngineContexts construction and
results.

In `@integrations/nvtx/server/src/lib.rs`:
- Around line 115-153: Add a shared Tokio Semaphore to NvtxModelCache and
acquire a permit inside the async initialization closure used by
NvtxModelCache::get before spawn_blocking. Move the permit into the blocking
task so imports, NvtxModelBuilder::build, and subsequent viewport work remain
bounded across distinct context IDs; preserve existing error propagation and
cache behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: 12d46dee-bf1d-406e-8ba2-1bd9547b79fb

📥 Commits

Reviewing files that changed from the base of the PR and between ceaa049 and 064ca8b.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (7)
  • Cargo.toml
  • domains/query_engine/server/src/analyzer_cache.rs
  • domains/query_engine/server/src/lib.rs
  • domains/query_engine/server/src/ui.rs
  • domains/query_engine/ui/src/lib.rs
  • integrations/nvtx/server/Cargo.toml
  • integrations/nvtx/server/src/lib.rs

Comment thread domains/query_engine/server/src/analyzer_cache.rs Outdated
Comment thread integrations/nvtx/server/src/lib.rs

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
domains/query_engine/server/src/ui.rs (1)

359-359: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Add the missing @quent/client contract. Define and export a typed fetcher and queryOptions for GET /api/engines/{engine_id}/contexts, with engine_id and context_resources: BTreeMap<Uuid, Vec<Uuid>> in the response type.

🤖 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 `@domains/query_engine/server/src/ui.rs` at line 359, Define and export the
`@quent/client` contract for GET /api/engines/{engine_id}/contexts, including a
typed fetcher and queryOptions. Model the response with engine_id and
context_resources as BTreeMap<Uuid, Vec<Uuid>>, and align the endpoint path and
parameter typing with the existing client contract conventions.

Source: Path instructions

🧹 Nitpick comments (1)
domains/query_engine/server/src/ui.rs (1)

137-137: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add endpoint tests for GET /api/engines/{engine_id}/contexts.

Cover a non-empty JSON response, an unknown engine_id returning an empty context_resources map, and a lister failure returning HTTP 500.

🤖 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 `@domains/query_engine/server/src/ui.rs` at line 137, Add endpoint tests for
the `GET /api/engines/{engine_id}/contexts` handler around the
`state.analyzers.contexts(engine_id)` call, covering a non-empty JSON response,
an unknown engine that returns an empty `context_resources` map, and a lister
failure that returns HTTP 500.

Source: Coding guidelines

🤖 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.

Outside diff comments:
In `@domains/query_engine/server/src/ui.rs`:
- Line 359: Define and export the `@quent/client` contract for GET
/api/engines/{engine_id}/contexts, including a typed fetcher and queryOptions.
Model the response with engine_id and context_resources as BTreeMap<Uuid,
Vec<Uuid>>, and align the endpoint path and parameter typing with the existing
client contract conventions.

---

Nitpick comments:
In `@domains/query_engine/server/src/ui.rs`:
- Line 137: Add endpoint tests for the `GET /api/engines/{engine_id}/contexts`
handler around the `state.analyzers.contexts(engine_id)` call, covering a
non-empty JSON response, an unknown engine that returns an empty
`context_resources` map, and a lister failure that returns HTTP 500.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: 6412b423-0bb8-4adf-af65-8cda2154ce62

📥 Commits

Reviewing files that changed from the base of the PR and between 064ca8b and 169183b.

📒 Files selected for processing (4)
  • domains/query_engine/server/src/analyzer_cache.rs
  • domains/query_engine/server/src/ui.rs
  • domains/query_engine/ui/src/lib.rs
  • integrations/nvtx/server/src/lib.rs
💤 Files with no reviewable changes (1)
  • domains/query_engine/ui/src/lib.rs

Comment thread integrations/nvtx/server/src/lib.rs
Comment thread integrations/nvtx/server/src/lib.rs
@9prady9
9prady9 requested a review from joosthooz August 13, 2026 09:42

@joosthooz joosthooz 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.

Thank you!

@9prady9

9prady9 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Thank you!

Thank you for the thorough reviews :)

@9prady9

9prady9 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit f40e69c into rapidsai:main Aug 13, 2026
20 checks passed
@9prady9
9prady9 deleted the pr/nvtx-server-routes branch August 13, 2026 15:00
rapids-bot Bot pushed a commit that referenced this pull request Aug 13, 2026
## Summary

- mount the context-scoped NVTX routes in simulator and generated quent-open viewers
- export engine-context and NVTX bindings through the UI packages
- add client fetchers, query options, and hooks for engine contexts, catalogs, and viewports
- canonicalize selector inputs, include query_start in requests and cache keys, and preserve the relative-second contract types


Follow up of #563

## Verification

- pixi run pnpm --dir ui typecheck
- pixi run pnpm --dir ui lint
- focused NVTX client and resource-tree tests
- relevant Rust viewer, simulator, and server test suites as part of the reconciled wave stack

Authors:
  - Pradeep Garigipati (https://github.com/9prady9)

Approvers:
  - Joe O'Hallaron (https://github.com/johallar)
  - Joost Hoozemans (https://github.com/joosthooz)

URL: #571
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.

3 participants