Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.

feat: enhance console-rust with OpenTelemetry support and refactor bridge integration#3

Merged
andersonleal merged 1 commit intomainfrom
feat/sdk-sync
Feb 9, 2026
Merged

feat: enhance console-rust with OpenTelemetry support and refactor bridge integration#3
andersonleal merged 1 commit intomainfrom
feat/sdk-sync

Conversation

@andersonleal
Copy link
Copy Markdown
Contributor

@andersonleal andersonleal commented Feb 9, 2026

feat: enhance console-rust with OpenTelemetry support and refactor bridge integration

Summary

  • OpenTelemetry support: Optional OTEL export via --otel and --otel-service-name (env: OTEL_ENABLED, OTEL_SERVICE_NAME). When enabled, the bridge is configured with OtelConfig (service name, version, engine URL) before connecting; the iii SDK initializes tracing/metrics/logs during connect().
  • Bridge lifecycle: Functions and triggers are registered before bridge.connect(), so they are queued and sent when the connection is established. Shutdown handler now calls bridge.disconnect() for clean teardown.
  • Bridge integration refactor: All engine calls use invoke_function_with_timeout (5s or 10s for traces tree) instead of unbounded invoke_function. Responses are normalized via success_response / error_response from bridge/error.rs.
  • Error handling: bridge/error.rs maps iii_sdk::IIIError to HTTP-style responses (e.g. NotConnected → 503, Timeout → 504, Remote → 502, Handler/Serde → 500, WebSocket → 503).
  • Dependencies: iii-sdk updated to use path ../../../sdk/packages/rust/iii with feature otel; axum pinned to 0.8.8. New transitive deps from SDK otel feature (opentelemetry, opentelemetry-proto, opentelemetry_sdk, prost, sysinfo, etc.) appear in Cargo.lock.

Type of Change

  • New feature (OpenTelemetry)
  • Refactoring (bridge registration order, timeouts, error responses)

Checklist

  • Code compiles (cargo build in packages/console-rust)
  • No new clippy warnings
  • Behavior: register functions/triggers before connect; optional OTEL; graceful disconnect on shutdown

Additional Context

  • Base branch: main (no develop in this repo).
  • Files changed: packages/console-rust/Cargo.toml, Cargo.lock, src/main.rs, src/bridge/error.rs, src/bridge/functions.rs, src/bridge/triggers.rs.
  • CLI: New flags --otel, --otel-service-name; existing --bridge-port (default 49134) used for engine WebSocket and OTEL config.
  • Testing: Manual run with/without --otel against a live iii engine recommended.

Summary by CodeRabbit

  • New Features

    • Added OpenTelemetry integration support with --otel flag to enable monitoring.
    • Added --otel-service-name CLI option to configure the service name for OpenTelemetry (defaults to "iii-console").
    • Environment variables now supported for OpenTelemetry configuration.
  • Chores

    • Updated SDK dependency path and enabled OpenTelemetry feature support.

…idge integration

- Add OpenTelemetry configuration options to the command-line interface for tracing and metrics.
- Refactor bridge integration to use the updated iii_sdk::III structure instead of iii_sdk::Bridge.
- Update error handling to align with the new IIIError type.
- Introduce new dependencies in Cargo.lock for async-stream and axum, and update existing dependencies for compatibility.
- Modify Cargo.toml to include new features for the iii-sdk and clap.

These changes improve observability and maintainability of the console-rust application.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

The console-rust package is updated to use a new III bridge type from iii-sdk with OpenTelemetry support, replacing the previous Bridge/BridgeError throughout. New CLI flags enable OTEL configuration and service naming.

Changes

Cohort / File(s) Summary
Dependency Updates
packages/console-rust/Cargo.toml
Updated iii-sdk path to ../../../sdk/packages/rust/iii with otel feature enabled; added env feature to clap.
Error Type Migration
packages/console-rust/src/bridge/error.rs
Replaced BridgeError with IIIError type throughout; updated error_response function signature and all error variant matches.
Bridge Function Updates
packages/console-rust/src/bridge/functions.rs
Updated all 20+ handler function signatures from &Bridge to &III parameter; replaced BridgeError with IIIError in error paths.
Trigger Registration
packages/console-rust/src/bridge/triggers.rs
Updated register_triggers signature from &Bridge/BridgeError to &III/IIIError.
CLI and Initialization
packages/console-rust/src/main.rs
Added otel and otel_service_name CLI flags; switched bridge initialization from Bridge::new to III::new; added conditional OTEL configuration before connect.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 From Bridge to III, the paths align,
With OpenTelemetry's golden shine,
Each function updated, consistent and clean,
OTEL flags dance on the CLI scene,
The refactor hops on, a rhythmic design!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the two main changes: OpenTelemetry support and bridge integration refactoring from Bridge to III.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/sdk-sync

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

Copy link
Copy Markdown

@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: 1

Caution

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

⚠️ Outside diff range comments (1)
packages/console-rust/src/bridge/functions.rs (1)

371-379: ⚠️ Potential issue | 🟠 Major

Path parameters key mismatch likely breaks delete.
handle_state_item_set reads path_parameters, while delete reads path_params. If the request schema uses the same key for both, delete will fail to resolve group/key.

🔧 Suggested fix (accept both keys)
-    let path_params = input.get("path_params");
+    let path_params = input
+        .get("path_parameters")
+        .or_else(|| input.get("path_params"));
🤖 Fix all issues with AI agents
In `@packages/console-rust/src/main.rs`:
- Around line 95-104: The OpenTelemetry config is incorrectly using bridge_url
for the engine WebSocket; in the block that calls bridge.set_otel_config with
iii_sdk::OtelConfig (inside the if args.otel handling where
args.otel_service_name is used), replace engine_ws_url: Some(bridge_url.clone())
with the ws_port-based engine WebSocket URL (use the existing ws_port
variable/formatting used elsewhere) so engine_ws_url points to the iii engine
WebSocket (port 3112) instead of the bridge endpoint.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant