Skip to content

Commit d4004db

Browse files
Disable credentials and build in metrics when plain text communication is used.
1 parent 6347ae7 commit d4004db

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

cloudspanner/src/main/java/site/ycsb/db/cloudspanner/CloudSpannerClient.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,13 @@ private static Spanner getSpanner(Properties properties, String host, String pro
181181
boolean usePlaintext = Boolean.parseBoolean(properties.getProperty(CloudSpannerProperties.USE_PLAINTEXT));
182182
if (usePlaintext) {
183183
optionsBuilder.setChannelConfigurator(ManagedChannelBuilder::usePlaintext);
184+
//Disable credentials and built in metrics when plaintext is used.
185+
optionsBuilder.setCredentials(NoCredentials.getInstance());
186+
optionsBuilder.setBuiltInMetricsEnabled(false);
184187
}
185188
String experimentalHost = properties.getProperty(CloudSpannerProperties.EXPERIMENTAL_HOST);
186189
if (experimentalHost != null) {
187190
optionsBuilder.setExperimentalHost(experimentalHost);
188-
//Disable IAM credentials for experimental Host.
189-
optionsBuilder.setCredentials(NoCredentials.getInstance());
190-
//Disable build in client native metrics when connecting to experimental host.
191-
optionsBuilder.setBuiltInMetricsEnabled(false);
192191
}
193192

194193
spanner = optionsBuilder.build().getService();

0 commit comments

Comments
 (0)