|
16 | 16 |
|
17 | 17 | package com.google.cloud.logging.spi; |
18 | 18 |
|
| 19 | +import static com.google.common.base.MoreObjects.firstNonNull; |
| 20 | + |
19 | 21 | import com.google.api.gax.core.RetrySettings; |
20 | 22 | import com.google.api.gax.grpc.ApiCallSettings; |
21 | 23 | import com.google.api.gax.grpc.ApiException; |
@@ -97,13 +99,18 @@ protected ExecutorFactory<ScheduledExecutorService> executorFactory() { |
97 | 99 | public DefaultLoggingRpc(LoggingOptions options) throws IOException { |
98 | 100 | executorFactory = new InternalLoggingOptions(options).executorFactory(); |
99 | 101 | executor = executorFactory.get(); |
| 102 | + String libraryName = options.libraryName(); |
| 103 | + String libraryVersion = firstNonNull(options.libraryVersion(), ""); |
100 | 104 | try { |
101 | | - ConfigServiceV2Settings.Builder confBuilder = |
102 | | - ConfigServiceV2Settings.defaultBuilder().provideExecutorWith(executor, false); |
103 | | - LoggingServiceV2Settings.Builder logBuilder = |
104 | | - LoggingServiceV2Settings.defaultBuilder().provideExecutorWith(executor, false); |
105 | | - MetricsServiceV2Settings.Builder metricsBuilder = |
106 | | - MetricsServiceV2Settings.defaultBuilder().provideExecutorWith(executor, false); |
| 105 | + ConfigServiceV2Settings.Builder confBuilder = ConfigServiceV2Settings.defaultBuilder() |
| 106 | + .provideExecutorWith(executor, false) |
| 107 | + .setClientLibHeader(libraryName, libraryVersion); |
| 108 | + LoggingServiceV2Settings.Builder logBuilder = LoggingServiceV2Settings.defaultBuilder() |
| 109 | + .provideExecutorWith(executor, false) |
| 110 | + .setClientLibHeader(libraryName, libraryVersion); |
| 111 | + MetricsServiceV2Settings.Builder metricsBuilder = MetricsServiceV2Settings.defaultBuilder() |
| 112 | + .provideExecutorWith(executor, false) |
| 113 | + .setClientLibHeader(libraryName, libraryVersion); |
107 | 114 | // todo(mziccard): PublisherSettings should support null/absent credentials for testing |
108 | 115 | if (options.host().contains("localhost") |
109 | 116 | || options.authCredentials().equals(AuthCredentials.noAuth())) { |
|
0 commit comments