Repository navigation
[client-v2] Add the CPU architecture to the User-Agent header - #3361
Merged
Merged
Conversation
The User-Agent comment group now has an arch:<os.arch> entry after os, for example (lv:java/17.0.21; os:Linux; arch:amd64; hc:ahc_5.6.4). Client metadata can set arch to replace the value, as for lv, os and hc. Implements: #2458 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Auto-approved by the AI review gate on 6214fb4. Details in the approver's comment on this pull request.
AI review gate — auto-approved
History (latest 5 heads, newest first)
|
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
chernser
approved these changes
Nov 17, 2026
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.
Summary
Implements #2458. The
User-Agentcomment group now has the CPU architecture that the JVM reports, as anarch:<os.arch>entry afteros:This is the field suggested in the issue comment (
arch:<os.arch>, the same key that clickhouse-cs sends). The architecture affects binary data SerDe, so it helps troubleshooting fromsystem.query_log.Closes #2458
Design
archonly if the client metadata does not set it (key compared ignoring case). An application can replace it withsetClientName(String, Map)orclient_id_metadata, for examplearch=arm64-v8a. Readers of the header must not expect the entry.os.archsystem property (amd64,aarch64,x86,ppc64le, ...), with no mapping. The JVM always setsos.arch, and its values contain none of;(), so the value is added without a check, asos.nameis.osvalue, as clickhouse-cs does, or as its own key).Compatibility
The
User-Agentoutput changes: a new entry betweenosandhc. Queries that parsehttp_user_agentby key are not affected. A pattern that expectshcdirectly afterosmust change. No public API change:WorkloadIdentitySupportis in theinternalpackage. The unreleasedhistory/latest/3202.mdentry still shows the format withoutarch;history/latest/2458.mdrecords the addition in the same release, so that entry is not changed.Changes
WorkloadIdentitySupport#composeClientPart: addarch:<os.arch>afteroswithClientUtils#putIfAbsentIgnoreCase. Class and method Javadoc updated.Client.Builder#setClientName(String, Map)Javadoc: the entries arelv,os,archandhc.docs/features.md(client-v2User-Agententry),docs/clickhouse-docs/client.mdx,docs/clickhouse-docs/jdbc.mdx,docs/integration-client.md,docs/integration-jdbc.md.history/latest/2458.md.Test
WorkloadIdentitySupportTest#testClientMetadataReplacesClientEntries: new rows.arch=replaces the value of the client;ARCH(upper case) together withOSandLV;archamong other replaced keys keeps the metadata order, and the client value is not added.UserAgentUnitTest(WireMock, exact header on the wire throughClient#query): the row withosmetadata now also setsarch.arch:<os.arch>afteros. This is the only change to their expectations:UserAgentUnitTest#userAgent,WorkloadIdentitySupportTest#userAgentand itsclientEntriesMetadatarows,HttpAPIClientHelperTest#clientPart(keeps the 200-character warning boundary exact),HttpTransportTests#testUserAgentHasCompleteProductNamepatterns,ConnectionTest#testClientMetadataInUserAgentsuffix.archafterhcmakes 34 of 40UserAgentUnitTest+WorkloadIdentitySupportTestcases fail.Run locally (ClickHouse 26.10.4.207, Java 17.0.21, Linux amd64, head
6214fb435): client-v2 unit 837/837; jdbc-v2 unit 2029/2029; client-v2HttpTransportTestsUser-Agent/client-name integration tests 11/11; jdbc-v2ConnectionTestUser-Agent/client info/framework integration tests 9/9; javadoc clean;packages/clickhouse-jdbc-allbuilds.Values in
system.query_log:docs/changes_checklist.mdkey:valueform and separators. It is checked end to end insystem.query_log(HttpTransportTests,ConnectionTest), not only by string equality.docs/features.md: updated for the new entry.🤖 Generated with Claude Code
Note
Low Risk
Observability-only change to the User-Agent string; no API or auth changes, though tools that parse
http_user_agentand assumehcfollowsosdirectly may need updating.Overview
HTTP requests from client-v2 (and jdbc-v2, which uses the same transport) now include an
arch:<os.arch>segment in the standard ClickHouseUser-Agentcomment group, placed afterosand beforehc.WorkloadIdentitySupport#composeClientPartadds the JVM’sos.archvalue when client metadata does not already setarch(case-insensitive override, same aslv,os, andhc). Apps can replace it viasetClientName(String, Map)orclient_id_metadata.Documentation, changelog (
history/latest/2458.md), and unit/integration tests that assert the exact header format were updated to expect the new field.Reviewed by Cursor Bugbot for commit 6214fb4. Bugbot is set up for automated code reviews on this repo. Configure here.