diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java index 23a5486829..4b2387b93e 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java @@ -825,11 +825,14 @@ public StreamWriter build() throws IOException { } String getFullTraceId() { - String version = GaxProperties.getLibraryVersion(StreamWriter.class); - if (traceId == null) { - return clientId + ":" + version; + String clientWithVersion = + GaxProperties.getLibraryVersion(StreamWriter.class).isEmpty() + ? clientId + : clientId + ":" + GaxProperties.getLibraryVersion(StreamWriter.class); + if (traceId == null || traceId.isEmpty()) { + return clientWithVersion; } else { - return clientId + ":" + version + " " + traceId; + return clientWithVersion + " " + traceId; } } }