Skip to content

Commit 39d392b

Browse files
committed
Comments incorporated
1 parent 846a002 commit 39d392b

File tree

4 files changed

+29
-22
lines changed

4 files changed

+29
-22
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ public String[] getValidValues() {
240240
static final boolean DEFAULT_RETURN_COMMIT_STATS = false;
241241
static final boolean DEFAULT_LENIENT = false;
242242
static final boolean DEFAULT_ROUTE_TO_LEADER = true;
243-
static final boolean DEFAULT_ENABLE_END_TO_END_TRACING = false;
244243
static final boolean DEFAULT_DELAY_TRANSACTION_START_UNTIL_FIRST_WRITE = false;
245244
static final boolean DEFAULT_KEEP_TRANSACTION_ALIVE = false;
246245
static final boolean DEFAULT_TRACK_SESSION_LEAKS = true;
@@ -251,6 +250,7 @@ public String[] getValidValues() {
251250
static final int DEFAULT_MAX_PARTITIONED_PARALLELISM = 1;
252251
static final Boolean DEFAULT_ENABLE_EXTENDED_TRACING = null;
253252
static final Boolean DEFAULT_ENABLE_API_TRACING = null;
253+
static final boolean DEFAULT_ENABLE_END_TO_END_TRACING = false;
254254
static final boolean DEFAULT_AUTO_BATCH_DML = false;
255255
static final long DEFAULT_AUTO_BATCH_DML_UPDATE_COUNT = 1L;
256256
static final boolean DEFAULT_AUTO_BATCH_DML_UPDATE_COUNT_VERIFICATION = true;
@@ -269,8 +269,6 @@ public String[] getValidValues() {
269269
/** Name of the 'routeToLeader' connection property. */
270270
public static final String ROUTE_TO_LEADER_PROPERTY_NAME = "routeToLeader";
271271
/** Name of the 'retry aborts internally' connection property. */
272-
public static final String ENABLE_END_TO_END_TRACING_PROPERTY_NAME = "enableEndToEndTracing";
273-
274272
public static final String RETRY_ABORTS_INTERNALLY_PROPERTY_NAME = "retryAbortsInternally";
275273
/** Name of the property to enable/disable virtual threads for the statement executor. */
276274
public static final String USE_VIRTUAL_THREADS_PROPERTY_NAME = "useVirtualThreads";
@@ -339,6 +337,7 @@ public String[] getValidValues() {
339337

340338
public static final String ENABLE_EXTENDED_TRACING_PROPERTY_NAME = "enableExtendedTracing";
341339
public static final String ENABLE_API_TRACING_PROPERTY_NAME = "enableApiTracing";
340+
public static final String ENABLE_END_TO_END_TRACING_PROPERTY_NAME = "enableEndToEndTracing";
342341

343342
public static final String AUTO_BATCH_DML_PROPERTY_NAME = "auto_batch_dml";
344343
public static final String AUTO_BATCH_DML_UPDATE_COUNT_PROPERTY_NAME =
@@ -386,10 +385,6 @@ static boolean isEnableTransactionalConnectionStateForPostgreSQL() {
386385
ROUTE_TO_LEADER_PROPERTY_NAME,
387386
"Should read/write transactions and partitioned DML be routed to leader region (true/false)",
388387
DEFAULT_ROUTE_TO_LEADER),
389-
ConnectionProperty.createBooleanProperty(
390-
ENABLE_END_TO_END_TRACING_PROPERTY_NAME,
391-
"Should we enable end to end tracing (true/false)",
392-
DEFAULT_ENABLE_END_TO_END_TRACING),
393388
ConnectionProperty.createBooleanProperty(
394389
RETRY_ABORTS_INTERNALLY_PROPERTY_NAME,
395390
"Should the connection automatically retry Aborted errors (true/false)",
@@ -545,7 +540,14 @@ static boolean isEnableTransactionalConnectionStateForPostgreSQL() {
545540
+ "to get a detailed view of each RPC that is being executed by your application, "
546541
+ "or if you want to debug potential latency problems caused by RPCs that are "
547542
+ "being retried.",
548-
DEFAULT_ENABLE_API_TRACING))));
543+
DEFAULT_ENABLE_API_TRACING),
544+
ConnectionProperty.createBooleanProperty(
545+
ENABLE_END_TO_END_TRACING_PROPERTY_NAME,
546+
"Enable end-to-end tracing (true/false) to generate traces for both the time "
547+
+ "that is spent in the client, as well as time that is spent in the Spanner server. "
548+
+ "Server side traces would always go to Google Cloud Trace so to see end to end traces, "
549+
+ "client should choose an exporter that exports the traces to Google Cloud Trace.",
550+
DEFAULT_ENABLE_END_TO_END_TRACING))));
549551

550552
private static final Set<ConnectionProperty> INTERNAL_PROPERTIES =
551553
Collections.unmodifiableSet(
@@ -1213,8 +1215,10 @@ public boolean isRouteToLeader() {
12131215
return getInitialConnectionPropertyValue(ROUTE_TO_LEADER);
12141216
}
12151217

1216-
/** Whether end-to-end tracing is enabled. */
1217-
public boolean enableEndToEndTracing() {
1218+
/**
1219+
* Whether end-to-end tracing is enabled.
1220+
*/
1221+
public boolean isEndToEndTracingEnabled() {
12181222
return getInitialConnectionPropertyValue(ENABLE_END_TO_END_TRACING);
12191223
}
12201224

google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionProperties.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,6 @@ class ConnectionProperties {
259259
DEFAULT_ROUTE_TO_LEADER,
260260
BooleanConverter.INSTANCE,
261261
Context.STARTUP);
262-
static final ConnectionProperty<Boolean> ENABLE_END_TO_END_TRACING =
263-
create(
264-
ENABLE_END_TO_END_TRACING_PROPERTY_NAME,
265-
"Should we enable end to end tracing (true/false)",
266-
DEFAULT_ENABLE_END_TO_END_TRACING,
267-
BooleanConverter.INSTANCE,
268-
Context.STARTUP);
269262
static final ConnectionProperty<Boolean> USE_VIRTUAL_THREADS =
270263
create(
271264
USE_VIRTUAL_THREADS_PROPERTY_NAME,
@@ -301,6 +294,16 @@ class ConnectionProperties {
301294
DEFAULT_ENABLE_API_TRACING,
302295
BooleanConverter.INSTANCE,
303296
Context.STARTUP);
297+
static final ConnectionProperty<Boolean> ENABLE_END_TO_END_TRACING =
298+
create(
299+
ENABLE_END_TO_END_TRACING_PROPERTY_NAME,
300+
"Enable end-to-end tracing (true/false) to generate traces for both the time "
301+
+ "that is spent in the client, as well as time that is spent in the Spanner server. "
302+
+ "Server side traces would always go to Google Cloud Trace so to see end to end traces, "
303+
+ "client should choose an exporter that exports the traces to Google Cloud Trace.",
304+
DEFAULT_ENABLE_END_TO_END_TRACING,
305+
BooleanConverter.INSTANCE,
306+
Context.STARTUP);
304307
static final ConnectionProperty<Integer> MIN_SESSIONS =
305308
create(
306309
MIN_SESSIONS_PROPERTY_NAME,

google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/SpannerPool.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ static class SpannerPoolKey {
156156
private final String userAgent;
157157
private final String databaseRole;
158158
private final boolean routeToLeader;
159-
private final boolean enableEndToEndTracing;
160159
private final boolean useVirtualGrpcTransportThreads;
161160
private final OpenTelemetry openTelemetry;
162161
private final Boolean enableExtendedTracing;
163162
private final Boolean enableApiTracing;
163+
private final boolean enableEndToEndTracing;
164164

165165
@VisibleForTesting
166166
static SpannerPoolKey of(ConnectionOptions options) {
@@ -187,11 +187,11 @@ private SpannerPoolKey(ConnectionOptions options) throws IOException {
187187
this.usePlainText = options.isUsePlainText();
188188
this.userAgent = options.getUserAgent();
189189
this.routeToLeader = options.isRouteToLeader();
190-
this.enableEndToEndTracing = options.enableEndToEndTracing();
191190
this.useVirtualGrpcTransportThreads = options.isUseVirtualGrpcTransportThreads();
192191
this.openTelemetry = options.getOpenTelemetry();
193192
this.enableExtendedTracing = options.isEnableExtendedTracing();
194193
this.enableApiTracing = options.isEnableApiTracing();
194+
this.enableEndToEndTracing = options.isEndToEndTracingEnabled();
195195
}
196196

197197
@Override
@@ -384,7 +384,7 @@ Spanner createSpanner(SpannerPoolKey key, ConnectionOptions options) {
384384
if (!options.isRouteToLeader()) {
385385
builder.disableLeaderAwareRouting();
386386
}
387-
if (options.enableEndToEndTracing()) {
387+
if (options.isEndToEndTracingEnabled()) {
388388
builder.setEnableEndToEndTracing(true);
389389
}
390390
if (key.usePlainText) {

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ConnectionOptionsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,13 @@ public void testBuildWithEndToEndTracingEnabled() {
334334
assertEquals(options.getProjectId(), TEST_PROJECT);
335335
assertEquals(options.getInstanceId(), TEST_INSTANCE);
336336
assertEquals(options.getDatabaseName(), TEST_DATABASE);
337-
assertTrue(options.enableEndToEndTracing());
337+
assertTrue(options.isEndToEndTracingEnabled());
338338

339339
// Test for default behavior for enableEndToEndTracing property.
340340
builder = ConnectionOptions.newBuilder().setUri(BASE_URI);
341341
builder.setCredentialsUrl(FILE_TEST_PATH);
342342
options = builder.build();
343-
assertFalse(options.enableEndToEndTracing());
343+
assertFalse(options.isEndToEndTracingEnabled());
344344
}
345345

346346
@Test

0 commit comments

Comments
 (0)