Skip to content

Commit

Permalink
Add gcsio version as usre agent for gRPC (#515)
Browse files Browse the repository at this point in the history
Co-authored-by: Igor Dvorzhak <[email protected]>
  • Loading branch information
hongyegong and medb authored Dec 29, 2020
1 parent 095cfce commit 66bcd59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ public GoogleCloudStorageImpl(
// Create the gRPC stub if necessary;
if (this.storageOptions.isGrpcEnabled()) {
this.storageStubProvider =
new StorageStubProvider(
this.storageOptions.getReadChannelOptions(), this.backgroundTasksThreadPool);
new StorageStubProvider(this.storageOptions, this.backgroundTasksThreadPool);
}

this.storageRequestAuthorizer = initializeStorageRequestAuthorizer(storageOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class StorageStubProvider {
.getExtension(ClientProto.defaultHost);

private final GoogleCloudStorageReadOptions readOptions;
private final String userAgent;
private final ExecutorService backgroundTasksThreadPool;
private final List<ChannelAndRequestCounter> mediaChannelPool;

Expand Down Expand Up @@ -130,8 +131,9 @@ public int activeRequests() {
}

public StorageStubProvider(
GoogleCloudStorageReadOptions readOptions, ExecutorService backgroundTasksThreadPool) {
this.readOptions = readOptions;
GoogleCloudStorageOptions options, ExecutorService backgroundTasksThreadPool) {
this.readOptions = options.getReadChannelOptions();
this.userAgent = options.getAppName();
this.backgroundTasksThreadPool = backgroundTasksThreadPool;
this.mediaChannelPool = new ArrayList<>();
}
Expand All @@ -146,6 +148,7 @@ private ChannelAndRequestCounter buildManagedChannel() {
.enableRetry()
.defaultServiceConfig(getGrpcServiceConfig())
.intercept(counter)
.userAgent(userAgent)
.build();
return new ChannelAndRequestCounter(channel, counter);
}
Expand Down

0 comments on commit 66bcd59

Please sign in to comment.