add query settings injection with OpenTelemetry trace context#102
Open
ancieg wants to merge 2 commits into
Open
add query settings injection with OpenTelemetry trace context#102ancieg wants to merge 2 commits into
ancieg wants to merge 2 commits into
Conversation
Enable passing ClickHouse query-level settings through the native protocol QUERY packet, filling the longstanding TODO in the protocol layer. The driver now mirrors clickhouse-driver (Python): arbitrary key-value settings are serialized in wire format and automatically merged from per-connection defaults (ClientOptions::settings) with optional per-query overrides on query_raw and insert_native_raw. OpenTelemetry distributed tracing is wired in as a first-class concern — the driver parses W3C traceparent headers from settings and populates the native protocol's OpenTelemetry field in ClientInfo, so queries appear in ClickHouse traces with correct trace/span IDs without any extra plumbing on the caller's side. Existing public API surface (query, execute, insert_native, etc.) continues to work unchanged, picking up default settings automatically.
…ction Covers default settings propagation, per-query overrides, and insert+readback round-trip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change lets the driver pass ClickHouse query settings through the client.
That's needed for distributed tracing. If you set a W3C traceparent value in
ClientOptions.settings(keyopentelemetry_traceparent), the driver copies it into the native protocol OpenTelemetry field so ClickHouse will nest query spans under the existing trace.IndexMap<String, String>), defaults to empty soClientOptions::default()behaviour is unchanged.query_rawandinsert_native_raw: new third argumentquery_settings: Option<IndexMap<String, String>>for per-query overrides (passNoneto keep defaults).Example: