From 714f08b34ae96cfc0a9371b093211e67c1b038be Mon Sep 17 00:00:00 2001 From: Mark Zitnik Date: Tue, 20 Aug 2024 19:09:17 +0300 Subject: [PATCH] Add to ClickHouseIO dedicated useragnet (#32253) --- CHANGES.md | 1 + .../java/org/apache/beam/sdk/io/clickhouse/ClickHouseIO.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 78f243a2055a..e1cb4be078e9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -66,6 +66,7 @@ * Improvements to the performance of BigqueryIO when using withPropagateSuccessfulStorageApiWrites(true) method (Java) ([#31840](https://github.com/apache/beam/pull/31840)). * [Managed Iceberg] Added support for writing to partitioned tables ([#32102](https://github.com/apache/beam/pull/32102)) * Update ClickHouseIO to use the latest version of the ClickHouse JDBC driver ([#32228](https://github.com/apache/beam/issues/32228)). +* Add ClickHouseIO dedicated User-Agent ([#32252](https://github.com/apache/beam/issues/32252)). ## New Features / Improvements diff --git a/sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/ClickHouseIO.java b/sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/ClickHouseIO.java index 688b08146f3e..52dca7cfa64a 100644 --- a/sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/ClickHouseIO.java +++ b/sdks/java/io/clickhouse/src/main/java/org/apache/beam/sdk/io/clickhouse/ClickHouseIO.java @@ -46,6 +46,7 @@ import org.apache.beam.sdk.util.BackOff; import org.apache.beam.sdk.util.BackOffUtils; import org.apache.beam.sdk.util.FluentBackoff; +import org.apache.beam.sdk.util.ReleaseInfo; import org.apache.beam.sdk.util.Sleeper; import org.apache.beam.sdk.values.PCollection; import org.apache.beam.sdk.values.PDone; @@ -178,12 +179,16 @@ public PDone expand(PCollection input) { tableSchema = getTableSchema(jdbcUrl(), table()); } + String sdkVersion = ReleaseInfo.getReleaseInfo().getSdkVersion(); + String userAgent = String.format("Apache Beam/%s", sdkVersion); + Properties properties = properties(); set(properties, "max_insert_block_size", maxInsertBlockSize()); set(properties, "insert_quorum", insertQuorum()); set(properties, "insert_distributed_sync", insertDistributedSync()); set(properties, "insert_deduplication", insertDeduplicate()); + set(properties, "product_name", userAgent); WriteFn fn = new AutoValue_ClickHouseIO_WriteFn.Builder()