clickhouse-java icon indicating copy to clipboard operation
clickhouse-java copied to clipboard

Make User-Agent to be filled correctly

Open chernser opened this issue 1 year ago • 1 comments

Describe the bug

ClickHouse Java Client is used by many connectors and products providing integration with ClickHouse. When such client within application is contacting a server such client send User-Agent header where very important information is packed. Part of this information is used for analytics and making decisions. Current implementation is may be not strict enough in this part because we do see strings like: metabase/1.3.3/unknown (Linux/6.1.0-12-amd64; OpenJDK 64-Bit Server VM/Temurin-11.0.22+7; HttpURLConnection; rv:unknown)

And there is no 100% guarantee that some integration used expected JDBC driver. What is more difficult is to match integration version with expected java client version and all its core components (for example, was Apache or HttpURLConnection used).

Expected behaviour

Whatever integration is used, what ever User-Agent header is passed there should be information from java client. Look https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent for reference.

chernser avatar Jun 19 '24 02:06 chernser

Look https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent for reference.

Does the language client spec do the trick?

mshustov avatar Jun 19 '24 07:06 mshustov

@chernser let's also add metadata for v2 API

mshustov avatar Jul 03 '24 13:07 mshustov

See: https://github.com/ClickHouse/clickhouse-java/blob/03fcfb179a066c9ed34a586ed3637d7da4b7383a/clickhouse-http-client/src/main/java/com/clickhouse/client/http/ClickHouseHttpConnection.java#L420

Paultagoras avatar Jul 15 '24 16:07 Paultagoras

Updated format: MyCustomClient ClickHouse-JavaClient/0.6.3 (OpenJDK 64-Bit Server VM/Corretto-17.0.6.10.1; HttpURLConnection)

Paultagoras avatar Jul 19 '24 17:07 Paultagoras