Repository: beam Updated Branches: refs/heads/master 5903e6994 -> 804440826
[BEAM-1794] BigtableIO: update user agent computation for new bigtable-client-core Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/282c3ff2 Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/282c3ff2 Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/282c3ff2 Branch: refs/heads/master Commit: 282c3ff2d599d23eeb7ad8aaa5af26f9020fc3f4 Parents: 5903e69 Author: Dan Halperin <dhalp...@google.com> Authored: Wed Mar 22 10:21:33 2017 -0700 Committer: Dan Halperin <dhalp...@google.com> Committed: Fri Mar 24 11:07:15 2017 -0700 ---------------------------------------------------------------------- .../beam/sdk/io/gcp/bigtable/BigtableIO.java | 24 +++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/282c3ff2/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java ---------------------------------------------------------------------- diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java index 9d02f65..a052e09 100644 --- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java +++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java @@ -215,7 +215,8 @@ public class BigtableIO { // Set data channel count to one because there is only 1 scanner in this session BigtableOptions.Builder clonedBuilder = options.toBuilder() .setDataChannelCount(1); - BigtableOptions optionsWithAgent = clonedBuilder.setUserAgent(getUserAgent()).build(); + BigtableOptions optionsWithAgent = + clonedBuilder.setUserAgent(getBeamSdkPartOfUserAgent()).build(); return new Read(optionsWithAgent, tableId, keyRange, filter, bigtableService); } @@ -449,7 +450,8 @@ public class BigtableIO { options.getBulkOptions().toBuilder() .setUseBulkApi(true) .build()); - BigtableOptions optionsWithAgent = clonedBuilder.setUserAgent(getUserAgent()).build(); + BigtableOptions optionsWithAgent = + clonedBuilder.setUserAgent(getBeamSdkPartOfUserAgent()).build(); return new Write(optionsWithAgent, tableId, bigtableService); } @@ -1047,16 +1049,16 @@ public class BigtableIO { } /** - * A helper function to produce a Cloud Bigtable user agent string. + * A helper function to produce a Cloud Bigtable user agent string. This need only include + * information about the Apache Beam SDK itself, because Bigtable will automatically append + * other relevant system and Bigtable client-specific version information. + * + * @see com.google.cloud.bigtable.config.BigtableVersionInfo */ - private static String getUserAgent() { - String javaVersion = System.getProperty("java.specification.version"); + private static String getBeamSdkPartOfUserAgent() { ReleaseInfo info = ReleaseInfo.getReleaseInfo(); - return String.format( - "%s/%s (%s); %s", - info.getName(), - info.getVersion(), - javaVersion, - "0.3.0" /* TODO get Bigtable client version directly from jar. */); + return + String.format("%s/%s", info.getName(), info.getVersion()) + .replace(" ", "_"); } }