Repository navigation
[v0.11.0] Send the User-Agent in the standard client format and add client metadata (backport #3213) - #3235
Conversation
…t-standard-format [client-v2] Send the User-Agent in the standard client format and add client metadata (cherry picked from commit 7f2cb57)
|
@polyglotAI-bot sync from |
chernser
left a comment
There was a problem hiding this comment.
sync with v0.11.0 to fix the CI build
…v0.11.0-user-agent
|
@chernser Done. I merged
|
TriageCategory: Summary What this impacts
Concerns
Required reviewer action
|
Add the User-Agent entry to the Breaking changes section of history/0_11_0_release/CHANGELOG.md, as requested in review. Remove history/latest/3202.md: the entry is now in the release changelog, and v0.11.0 has no history/latest/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Summary
Backports #3213 from
maintov0.11.0, as @chernser requested in #3232:Issue: #3232. A closing keyword has no effect on a PR into a non-default branch, so close the issue manually after the merge.
Cherry-picked PR
main7f2cb578724bd9ee11(1 conflict, in a test)Command:
git cherry-pick -x -m 1 7f2cb5787. The commit keeps its original author and records its source commit.Conflict
There is one conflict, in
executeQueryAndVerifyUserAgentinjdbc-v2/src/test/java/com/clickhouse/jdbc/ConnectionTest.java. Onmain, #3187 changed this helper to a retry loop before #3213 merged. #3187 is not onv0.11.0. #3213 makes two changes to the helper: the return type changes fromvoidtoString, and the helper returnsuserAgent.Resolution (the same as in #3232 (comment)):
v0.11.0body of the helper.return userAgent;as the last statement of itstryblock.testClientMetadataInUserAgenttest, its data provider, and theVersionsimport.Diff check
26 files, +982/−97. These are the same counts as #3213 on
main, and the file list and file status (added, modified, deleted) are the same.ConnectionTest.java, the added lines are also identical, butreturn userAgent;has one more indent level, because it is in thetryblock of thev0.11.0helper.The branch has no other changes.
Note:
history/latest/3202.md(the release-note fragment of #3213) createshistory/latest/on this branch, becausev0.11.0does not have that directory. #3234 does the same withhistory/latest/3203.md. I kept the file as is, because the request is cherry-pick only. If the branch needs a different release-note layout, move the entry tohistory/0_11_0_release/CHANGELOG.md.Test
Done in a devbox (JDK 17 + JDK 8 toolchain, Maven 3.9.15, ClickHouse server 26.9.1):
mvn -B -DskipTests -Dmaven.javadoc.skip=true install(all 9 modules, includingpackages/clickhouse-jdbc-all):BUILD SUCCESS. The test sources also compile.client-v2unit tests (mvn -pl client-v2 test): 796 run, 0 failures. This includes the 140 tests in the classes that [client-v2] Send the User-Agent in the standard client format and add client metadata #3213 adds or changes (UserAgentUnitTest,VersionsTest,WorkloadIdentitySupportTest,ClientUtilsTest,ClientConfigPropertiesTest,HttpAPIClientHelperTest,InsertExceptionClassificationTest).client-v2HttpTransportTests#testUserAgentHasCompleteProductName+testClientName+testClientNameThruRawOptions(integration): 11 run, 0 failures.jdbc-v2ConnectionTest(integration, the class with the conflict): 62 run, 59 pass, 1 skipped, 2 failures. All oftestClientMetadataInUserAgent,setAndGetClientInfoTestandinfluenceUserAgentClientNameTestpass. The 2 failures aretestSecureConnectionandtestSSLModeVerifyCa. They also fail onorigin/v0.11.0with no changes. They use the self-signed certificate forlocalhost, and the server in this environment has a different host name.CI
CI on this PR is expected to fail before compilation starts, for a cause that is not in this PR. The CI runners use Maven 3.10.0, and on
v0.11.0,packages/clickhouse-jdbc-all/pom.xmldeclaresmaven-jar-plugintwo times. Details and the options are in #3233 (comment). Whenv0.11.0has the fix, I mergev0.11.0into this branch.This PR adds no tests, docs, CHANGELOG entry or version bump other than those in #3213.
Checklist
🤖 Generated with Claude Code
Note
Medium Risk
Every HTTP request’s
User-Agentstring changes format, so anything parsinghttp_user_agentinsystem.query_logmust be updated; misconfigured metadata fails at client build time.Overview
Backport of #3213 to
v0.11.0: HTTPUser-Agentis now built in the standard ClickHouse client shape and can carry optional workload metadata.The client composes headers as
<app> clickhouse-java-v2/<version> (key:value; …; lv:java/…; os:…; hc:ahc_…)instead of the older(OS; jvm:…)plus trailingApache-HttpClient/….WorkloadIdentitySupportowns composition and caching;HttpAPIClientHelperdelegates to it.Client.Builder#setClientName(String, Map)and theclient_id_metadataconfig add validated key/value pairs to the comment group (withlv,os,hcfilled in when not overridden). Client version and Apache HttpClient version come from a build-generatedVersionsclass (templating-maven-plugin+java-templates), replacing filteredclient-v2-version.properties.Docs, changelog, JDBC integration tests for metadata, and broad unit/integration coverage are included. The only merge tweak is
ConnectionTest#executeQueryAndVerifyUserAgentreturning the captured user agent onv0.11.0.Reviewed by Cursor Bugbot for commit ef48cc2. Bugbot is set up for automated code reviews on this repo. Configure here.