feat: enhance console-rust with OpenTelemetry support and refactor bridge integration#3
Conversation
…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.
📝 WalkthroughWalkthroughThe 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 | 🟠 MajorPath parameters key mismatch likely breaks delete.
handle_state_item_setreadspath_parameters, while delete readspath_params. If the request schema uses the same key for both, delete will fail to resolvegroup/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.
feat: enhance console-rust with OpenTelemetry support and refactor bridge integration
Summary
--oteland--otel-service-name(env:OTEL_ENABLED,OTEL_SERVICE_NAME). When enabled, the bridge is configured withOtelConfig(service name, version, engine URL) before connecting; the iii SDK initializes tracing/metrics/logs duringconnect().bridge.connect(), so they are queued and sent when the connection is established. Shutdown handler now callsbridge.disconnect()for clean teardown.invoke_function_with_timeout(5s or 10s for traces tree) instead of unboundedinvoke_function. Responses are normalized viasuccess_response/error_responsefrombridge/error.rs.bridge/error.rsmapsiii_sdk::IIIErrorto HTTP-style responses (e.g.NotConnected→ 503,Timeout→ 504,Remote→ 502,Handler/Serde→ 500,WebSocket→ 503).iii-sdkupdated to use path../../../sdk/packages/rust/iiiwith featureotel;axumpinned to0.8.8. New transitive deps from SDK otel feature (opentelemetry, opentelemetry-proto, opentelemetry_sdk, prost, sysinfo, etc.) appear inCargo.lock.Type of Change
Checklist
cargo buildinpackages/console-rust)Additional Context
main(nodevelopin this repo).packages/console-rust/Cargo.toml,Cargo.lock,src/main.rs,src/bridge/error.rs,src/bridge/functions.rs,src/bridge/triggers.rs.--otel,--otel-service-name; existing--bridge-port(default 49134) used for engine WebSocket and OTEL config.--otelagainst a live iii engine recommended.Summary by CodeRabbit
New Features
--otelflag to enable monitoring.--otel-service-nameCLI option to configure the service name for OpenTelemetry (defaults to "iii-console").Chores