Skip to content

Commit

Permalink
fix: add version id to the client lib header (#2447)
Browse files Browse the repository at this point in the history
* fix:add version id to the client lib header

* .
  • Loading branch information
yirutang committed Mar 12, 2024
1 parent d629194 commit 43fd699
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.api.gax.batching.FlowController;
import com.google.api.gax.core.CredentialsProvider;
import com.google.api.gax.core.ExecutorProvider;
import com.google.api.gax.core.GaxProperties;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.auth.Credentials;
Expand Down Expand Up @@ -824,10 +825,14 @@ public StreamWriter build() throws IOException {
}

String getFullTraceId() {
if (traceId == null) {
return clientId;
String clientWithVersion =
GaxProperties.getLibraryVersion(StreamWriter.class).isEmpty()
? clientId
: clientId + ":" + GaxProperties.getLibraryVersion(StreamWriter.class);
if (traceId == null || traceId.isEmpty()) {
return clientWithVersion;
} else {
return clientId + " " + traceId;
return clientWithVersion + " " + traceId;
}
}
}
Expand Down

0 comments on commit 43fd699

Please sign in to comment.