Skip to content

Conversation

@grahamking
Copy link
Contributor

@grahamking grahamking commented Oct 7, 2025

Prefix all our etcd keys with v1/ to give us upgrade options in the future.

Note there is no effort to manage versions centrally, we aren't enforcing all keys upgrade in lockstep, or even implementing an upgrade feature. We're giving future-us space to work.

Summary by CodeRabbit

  • New Features
    • Introduced versioned keyspace (v1/…) for configurations, ports, instances, models, and routers to improve namespacing and future compatibility.
  • Refactor
    • Standardized path parsing and validation for etcd keys; simplified prefix handling.
  • Observability
    • Reduced log noise: cache update/delete logs lowered to trace; watcher stop logs to debug.
  • Documentation
    • Updated examples to reflect v1-prefixed paths.
  • Tests
    • Adjusted timing threshold for pool performance test to reduce flakiness; updated test constants to v1-prefixed buckets.

Prefix all our etcd keys with `v1/` to give us upgrade options in the
future.

Note there is no effort to manage versions centrally, we aren't
enforcing all keys upgrade in lockstep, or even implementing an upgrade
feature. We're giving future-us space to work.

Signed-off-by: Graham King <[email protected]>
@grahamking grahamking requested a review from a team as a code owner October 7, 2025 15:40
@github-actions github-actions bot added the feat label Oct 7, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Introduces versioned etcd key prefixes ("v1/...") across components, updates KvCache to accept a version parameter and construct prefixed paths, tightens watcher key parsing/validation, removes slugifying from storage keys, adjusts some log levels, and updates tests/docs accordingly. Control flow largely unchanged.

Changes

Cohort / File(s) Summary
Versioned etcd prefixes and roots
lib/llm/src/discovery.rs, lib/llm/src/model_card.rs, lib/runtime/src/component.rs, lib/runtime/src/transports/etcd/path.rs, lib/bindings/python/rust/lib.rs
Updated constants and key builders to use "v1/..." namespaces: KV router root, model card root, instance root, ETCD_ROOT_PATH, and port reservation keys. Added ENDPOINT_KEYWORD constant. Adjusted Namespace etcd path formatting and imported ETCD_ROOT_PATH.
KvCache API/version prefixing and logging
lib/runtime/src/transports/etcd.rs, lib/bindings/python/rust/planner.rs
KvCache::new now takes version: &str and prepends it to the prefix; callsite updated to pass "v1". Downgraded some logs (update/delete to trace; watcher stop to debug).
Watchers and key parsing
lib/llm/src/discovery/watcher.rs, lib/runtime/src/utils/worker_monitor.rs
Tightened etcd key extraction to require paths starting with model_card::ROOT_PATH and fixed segment indices (assumes "v1/..."). Removed optional "v1" handling, added size checks. Updated watched prefix from "mdc/" to "v1/mdc/". Adjusted embeddings model addition call signature.
Key-value storage key formatting
lib/runtime/src/storage/key_value_store/etcd.rs, lib/runtime/src/storage/key_value_store.rs
Dropped slugification from etcd key construction; keys built as "bucket/key". Tests updated to use bucket "v1/mdc".
Docs and test timing adjustments
lib/runtime/src/utils/pool.rs, lib/runtime/src/utils/typed_prefix_watcher.rs
Relaxed a performance assertion (50ms → 200ms) with comments. Doc example prefix updated from "mdc/" to "v1/mdc/".

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Svc as Service/Component
  participant KC as KvCache
  participant ET as etcd

  Note over Svc,KC: Initialization (versioned prefix)
  Svc->>KC: new(client, "v1", prefix, initial_values)
  KC->>KC: store prefix = "v1/" + prefix

  Note over KC,ET: Watch + Cache
  KC->>ET: watch("v1/" + prefix)
  ET-->>KC: events (put/delete)
  KC->>KC: update in-memory cache
  KC-->>Svc: getter returns cached values

  Note over Svc,ET: Writes use versioned keys
  Svc->>ET: put/get/delete with keys under "v1/..."
Loading
sequenceDiagram
  autonumber
  participant W as Model Watcher
  participant ET as etcd
  participant L as LLM Registry

  Note over W: Key extraction stricter
  W->>ET: watch("v1/mdc/...")
  ET-->>W: event with key
  W->>W: validate starts_with("v1/mdc") and parts count
  alt valid key
    W->>L: add/update model(card.name(), checksum, engine)
  else invalid
    W-->>W: error: reject key
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A bunny hops through versioned lanes,
"v1" on every path remains.
Keys no longer wear a slug,
Watchers parse with tighter hug.
Cache now knows the version’s song—
Trace logs whisper all day long.
Thump! The carrots map where they belong.

Pre-merge checks

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description does not follow the repository’s required template: it omits the “Overview,” “Details,” “Where should the reviewer start?” and “Related Issues” sections and lacks structured guidance on review starting points or linked issues. Please update the description to include the template headings (“Overview,” “Details,” “Where should the reviewer start?,” and “Related Issues”) and provide details under each section, specifying files for review and any issue numbers the PR addresses.
Docstring Coverage ⚠️ Warning Docstring coverage is 73.08% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title “feat(etcd): Version the etcd keys” accurately and concisely summarizes the primary change of prefixing all etcd keys with a version string, following conventional commit style and providing clear context for reviewers.

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

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

⚠️ Outside diff range comments (1)
lib/llm/src/discovery/watcher.rs (1)

586-589: Fix the test to avoid double "v1/" prefix.

The test creates a key with format "v1/{}/..." where model_card::ROOT_PATH is already "v1/mdc", resulting in "v1/v1/mdc/...". This doesn't match the expected key format described in the comment at line 559.

Apply this diff to fix the test:

-        let input = format!(
-            "v1/{}/dynamo/backend/generate/694d9981145a61ad",
-            model_card::ROOT_PATH
-        );
+        let input = format!(
+            "{}/dynamo/backend/generate/694d9981145a61ad",
+            model_card::ROOT_PATH
+        );
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 81162df and f26e049.

📒 Files selected for processing (13)
  • lib/bindings/python/rust/lib.rs (1 hunks)
  • lib/bindings/python/rust/planner.rs (1 hunks)
  • lib/llm/src/discovery.rs (1 hunks)
  • lib/llm/src/discovery/watcher.rs (2 hunks)
  • lib/llm/src/model_card.rs (1 hunks)
  • lib/runtime/src/component.rs (3 hunks)
  • lib/runtime/src/storage/key_value_store.rs (1 hunks)
  • lib/runtime/src/storage/key_value_store/etcd.rs (2 hunks)
  • lib/runtime/src/transports/etcd.rs (3 hunks)
  • lib/runtime/src/transports/etcd/path.rs (9 hunks)
  • lib/runtime/src/utils/pool.rs (1 hunks)
  • lib/runtime/src/utils/typed_prefix_watcher.rs (1 hunks)
  • lib/runtime/src/utils/worker_monitor.rs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
lib/bindings/python/rust/planner.rs (1)
lib/runtime/src/transports/etcd.rs (2)
  • new (93-126)
  • new (516-562)
lib/llm/src/discovery/watcher.rs (3)
lib/llm/src/local_model.rs (3)
  • card (331-333)
  • endpoint_id (106-109)
  • endpoint_id (389-391)
lib/llm/src/discovery/model_manager.rs (1)
  • checksum (397-399)
lib/runtime/src/component.rs (1)
  • endpoint_id (107-113)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Build and Test - dynamo
  • GitHub Check: clippy (launch/dynamo-run)
  • GitHub Check: tests (launch/dynamo-run)
  • GitHub Check: tests (.)
  • GitHub Check: tests (lib/runtime/examples)
  • GitHub Check: tests (lib/bindings/python)
  • GitHub Check: clippy (.)
  • GitHub Check: clippy (lib/bindings/python)
🔇 Additional comments (18)
lib/runtime/src/utils/typed_prefix_watcher.rs (1)

73-73: LGTM! Documentation updated to reflect versioned keys.

The example correctly demonstrates the new versioned prefix scheme ("v1/mdc/") introduced by this PR. This documentation update helps developers understand the expected key format without affecting any runtime behavior.

lib/runtime/src/storage/key_value_store.rs (1)

255-255: LGTM!

Test bucket name correctly updated to include the v1 prefix, consistent with the versioning scheme.

lib/runtime/src/utils/worker_monitor.rs (1)

97-97: LGTM!

The watched prefix correctly updated to use the versioned path, aligning with the model_card::ROOT_PATH constant change.

lib/bindings/python/rust/lib.rs (1)

597-597: LGTM!

Port key format correctly updated to use the v1 prefix, replacing the previous "dyn://" scheme.

lib/llm/src/discovery.rs (1)

11-11: LGTM!

The KV Router root path correctly updated to include the v1 prefix. Note that as a public constant, this is technically a breaking change for any external code referencing it directly.

lib/llm/src/model_card.rs (1)

37-37: LGTM!

The model card root path correctly updated to include the v1 prefix. As a public constant, this is technically a breaking change for any external code referencing it directly.

lib/llm/src/discovery/watcher.rs (2)

415-415: LGTM!

The embeddings model addition correctly uses card.name() and passes the checksum parameter.


562-577: LGTM!

The tightened validation and simplified path parsing logic correctly enforces the versioned key format. The requirement that keys must start with model_card::ROOT_PATH provides clear validation upfront.

lib/runtime/src/transports/etcd/path.rs (3)

11-11: LGTM!

The etcd root path correctly updated to include the v1 prefix, removing the scheme-based format ("dynamo://") in favor of a simple versioned path.


17-17: LGTM!

The addition of the ENDPOINT_KEYWORD constant complements the existing COMPONENT_KEYWORD and maintains consistency in the path structure.


376-539: LGTM!

All tests correctly updated to use the new ETCD_ROOT_PATH format. The test coverage remains comprehensive, including edge cases for lease IDs and path validation.

lib/runtime/src/storage/key_value_store/etcd.rs (1)

243-243: Confirm callers use version-prefixed bucket names
Removed slugification in Etcd storage means bucket_name is now used raw. Ensure every get_or_create_bucket and get_bucket invocation passes a pre-formatted, version-prefixed name (e.g. "v1/mdc" instead of "mdc").

lib/runtime/src/transports/etcd.rs (3)

516-524: LGTM! Version parameter correctly implemented.

The addition of the version parameter and the prefix construction using format!("{version}/{prefix}") properly implements the versioned key strategy described in the PR objectives.


579-579: LGTM! Appropriate log level adjustments.

Changing KvCache update/delete logs to trace! and the watcher stop message to debug! appropriately reduces log noise for cache operations while maintaining observability.

Also applies to: 586-586, 593-593


723-723: LGTM! Test correctly updated.

The test properly passes the "v1" version parameter to align with the new API signature.

lib/runtime/src/component.rs (3)

37-37: LGTM! Import consolidation.

Importing ETCD_ROOT_PATH from the etcd module centralizes the path definition and aligns with the versioned key strategy.


75-75: LGTM! Consistent versioned path.

Updating INSTANCE_ROOT_PATH to "v1/instances" consistently applies the version prefix across the codebase.


601-601: LGTM! Correct usage of imported constant.

The usage of the imported ETCD_ROOT_PATH correctly constructs the namespace path.

Signed-off-by: Graham King <[email protected]>
Copy link
Contributor

@nv-anants nv-anants left a comment

Choose a reason for hiding this comment

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

not too familiar with etcd migration changes, but otherwise lgtm

@grahamking grahamking enabled auto-merge (squash) October 7, 2025 16:40
@grahamking grahamking merged commit a5371bf into main Oct 7, 2025
27 of 28 checks passed
@grahamking grahamking deleted the gk-etcd-keys-v1 branch October 7, 2025 16:48
ptarasiewiczNV pushed a commit that referenced this pull request Oct 8, 2025
Signed-off-by: Graham King <[email protected]>
Signed-off-by: Piotr Tarasiewicz <[email protected]>
nv-tusharma pushed a commit that referenced this pull request Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants