Skip to content

Expose X-ClickHouse-Server-Display-Name header via client-v2 API#2744

Open
synhershko wants to merge 1 commit intoClickHouse:mainfrom
BigDataBoutique:expose-server-display-name-header
Open

Expose X-ClickHouse-Server-Display-Name header via client-v2 API#2744
synhershko wants to merge 1 commit intoClickHouse:mainfrom
BigDataBoutique:expose-server-display-name-header

Conversation

@synhershko
Copy link

@synhershko synhershko commented Feb 13, 2026

Extract the server display name from HTTP response headers and surface it through OperationMetrics, QueryResponse, InsertResponse, and CommandResponse, following the existing queryId pattern.


Note

Low Risk
Small, additive API change that only reads an extra response header and exposes it via new getters; minimal behavioral impact beyond the metrics/response surface.

Overview
Surfaces the X-ClickHouse-Server-Display-Name HTTP response header through the client-v2 API.

Client now captures this header into OperationMetrics, and QueryResponse, InsertResponse, and CommandResponse add getServerDisplayName() accessors (mirroring the existing queryId plumbing), with OperationMetrics#toString() updated accordingly.

Written by Cursor Bugbot for commit 1e47a0b. This will update automatically on new commits. Configure here.

Extract the server display name from HTTP response headers and surface
it through OperationMetrics, QueryResponse, InsertResponse, and
CommandResponse, following the existing queryId pattern.

Signed-off-by: Itamar Syn-Hershko <itamar@bigdataboutique.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

String queryId = HttpAPIClientHelper.getHeaderVal(httpResponse.getFirstHeader(ClickHouseHttpProto.HEADER_QUERY_ID), requestSettings.getQueryId(), String::valueOf);
metrics.operationComplete();
metrics.setQueryId(queryId);
metrics.setServerDisplayName(HttpAPIClientHelper.getHeaderVal(
Copy link
Contributor

Choose a reason for hiding this comment

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

@synhershko
Metrics is not a good place for headers:

  • header is not a metrics
  • we will rework metrics and removing header from it will be problematic
  • native protocol may have another way to pass this information.

I suggest:

  • create Map<String, String> collectResponseHeaders(HttpResponse) in HttpAPIClientHelper
  • add Map<String, String> responseHeaders to insert and query response classes
  • it can be a getters for significant headers or a getter method returning all headers.

Thank you!

@chernser
Copy link
Contributor

Good day, @synhershko !
Thank you for the contribution!
Please see my comment.

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants