-
Notifications
You must be signed in to change notification settings - Fork 151
clickhouse routing for client hosted data plane #1073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed everything up to 45baa37 in 1 minute and 25 seconds. Click for details.
- Reviewed
826lines of code in9files - Skipped
0files when reviewing. - Skipped posting
6draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. app-server/src/sql/mod.rs:46
- Draft comment:
Consider precomputing the regex string for ERROR_END_REGEX instead of using format! inside the LazyLock closure. While it works, precomputing may improve clarity and avoid potential lifetime confusion. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. app-server/src/main.rs:1040
- Draft comment:
The main function spawns several threads and later joins them. Consider adding more robust error handling for thread panics and documenting the design intent to ensure that blocking operations via block_on in spawned threads are safe. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. app-server/src/traces/consumer.rs:191
- Draft comment:
Mixing Rayon’s parallel iterator for heavy CPU-bound work with async tasks is a good strategy, but ensure that this parallel processing does not starve your Tokio runtime. Consider verifying that the Rayon thread pool is appropriately tuned or use a dedicated CPU-bound thread pool if needed. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. app-server/src/utils/mod.rs:112
- Draft comment:
In the sanitize_string function, you filter out control characters including null and invalid UTF-8. Double–check that this filtering does not unintentionally remove characters that might be valid in your application context. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
5. frontend/lib/db/migrations/0062_deployment_mode.sql:1
- Draft comment:
The migration adds new columns for deployment mode and data plane URL. Ensure that these schema changes are backward–compatible and consider whether an index on deployment_mode might improve query performance if used frequently. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
6. app-server/src/traces/consumer.rs:82
- Draft comment:
Typo detected: "conneciton" should be corrected to "connection". - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_RY9jTcYS91uTy27t
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
| .header("Authorization", format!("Bearer {}", jwt_token)) | ||
| .header("Content-Type", "application/json") | ||
| .json(&request_body) | ||
| .send() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: CHSpan UUID serialization incompatible with JSON format
The DataPlaneWriteRequest serializes CHSpan data to JSON via reqwest::Client::json(). However, CHSpan uses #[serde(with = "clickhouse::serde::uuid")] for UUID fields, which is designed for ClickHouse's binary protocol, not JSON serialization. When serialized to JSON, UUID fields (span_id, parent_span_id, project_id, trace_id) will use the ClickHouse-specific format instead of standard JSON UUID strings, likely causing the data plane to fail parsing or storing corrupted data.
Note
Routes SQL queries and span writes to a workspace-specific data plane when in HYBRID mode, authenticated via short-lived JWTs; adds workspace routing metadata and DB migration.
DeploymentModeenum andWorkspacemodel withdeployment_modeand optionaldata_plane_urlindb/projects.rs.get_workspace_by_project_idto fetch workspace for routing.execute_sql_querynow routes:CLOUD/SELF_HOST→ local ClickHouse (RO client).HYBRID→ newexecute_sql_query_on_data_planevia HTTPPOST {data_plane_url}/clickhouse/readwith JWT.validate_queryhelper; added request structDataPlaneReadRequest.HYBRID, send spans to{data_plane_url}/clickhouse/writewith JWT (DataPlaneWriteRequest); otherwise write to local ClickHouse.reqwest::Clientinto workers.generate_data_plane_jwt) with cached tokens per workspace (moka), usingDATA_PLANE_PRIVATE_KEY.reqwest::Clientinto HTTP handlers and consumer workers.workspaces.deployment_mode TEXT DEFAULT 'CLOUD'andworkspaces.data_plane_url.jsonwebtoken; lockfile updates for JWT-related crates.Written by Cursor Bugbot for commit 45baa37. This will update automatically on new commits. Configure here.
Important
Adds ClickHouse query routing based on deployment mode with JWT authentication for data plane communication.
execute_sql_query_on_data_plane()insql/mod.rsfor routing SQL queries to data plane in HYBRID mode.execute_sql_query()inapi/v1/sql.rsto handle different deployment modes (CLOUD, SELF_HOST, HYBRID).utils/mod.rs.deployment_modeanddata_plane_urlcolumns toworkspacestable in0062_deployment_mode.sql.DeploymentModeenum andget_workspace_by_project_id()indb/projects.rs.jsonwebtokentoCargo.tomlandCargo.lockfor JWT support.main.rsto initialize HTTP client for data plane communication.traces/consumer.rsto route span data to data plane in HYBRID mode.This description was created by
for 45baa37. You can customize this summary. It will automatically update as commits are pushed.