Skip to content

Commit 5c2248e

Browse files
authored
Update client name in header for Veneer layer (#1638)
1 parent 75baf79 commit 5c2248e

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

google-cloud-core/src/main/java/com/google/cloud/GrpcServiceOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ protected ChannelProvider getChannelProvider() {
313313
InstantiatingChannelProvider.Builder builder = InstantiatingChannelProvider.newBuilder()
314314
.setServiceAddress(hostAndPort.getHostText())
315315
.setPort(hostAndPort.getPort())
316-
.setClientLibHeader(getLibraryName(), firstNonNull(getLibraryVersion(), ""));
316+
.setClientLibHeader(getGoogApiClientLibName(), firstNonNull(getLibraryVersion(), ""));
317317
Credentials scopedCredentials = getScopedCredentials();
318318
if (scopedCredentials != null && scopedCredentials != NoCredentials.getInstance()) {
319319
builder.setCredentialsProvider(FixedCredentialsProvider.create(scopedCredentials));

google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public abstract class ServiceOptions<ServiceT extends Service<OptionsT>, Service
7474
private static final String MANIFEST_VERSION_KEY = "Implementation-Version";
7575
private static final String ARTIFACT_ID = "google-cloud-core";
7676
private static final String LIBRARY_NAME = "gcloud-java";
77+
private static final String X_GOOGLE_CLIENT_HEADER_NAME = "gccl";
7778
private static final String LIBRARY_VERSION = defaultLibraryVersion();
7879
private static final String APPLICATION_NAME =
7980
LIBRARY_VERSION == null ? LIBRARY_NAME : LIBRARY_NAME + "/" + LIBRARY_VERSION;
@@ -601,6 +602,13 @@ public String getLibraryName() {
601602
return LIBRARY_NAME;
602603
}
603604

605+
/**
606+
* Returns the library's name used by x-goog-api-client header as a string.
607+
*/
608+
public String getGoogApiClientLibName() {
609+
return X_GOOGLE_CLIENT_HEADER_NAME;
610+
}
611+
604612
/**
605613
* Returns the library's version as a string.
606614
*/

0 commit comments

Comments
 (0)