Skip to content

Commit 0aa51ff

Browse files
committed
resolve comments
1 parent 6af5e04 commit 0aa51ff

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,9 @@ public Builder setEnableExtendedTracing(boolean enableExtendedTracing) {
14091409

14101410
/**
14111411
* Enable spanner server side tracing. Enabling this option will create the trace spans at the
1412-
* Spanner layer. By default, server side tracing is disabled.
1412+
* Spanner layer. By default, server side tracing is disabled. Enabling server side tracing
1413+
* requires OpenTelemetry to be set up properly. Simply enabling this option won't generate
1414+
* server side traces.
14131415
*/
14141416
public Builder enableServerSideTracing() {
14151417
this.enableServerSideTracing = true;
@@ -1515,7 +1517,7 @@ public static void enableOpenCensusTraces() {
15151517
@ObsoleteApi(
15161518
"The OpenCensus project is deprecated. Use enableOpenTelemetryTraces to switch to OpenTelemetry traces")
15171519
@VisibleForTesting
1518-
public static void resetActiveTracingFramework() {
1520+
static void resetActiveTracingFramework() {
15191521
activeTracingFramework = null;
15201522
}
15211523

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.spanner;
18+
19+
/** Helper to configure SpannerOptions for tests. */
20+
public class SpannerOptionsHelper {
21+
22+
/**
23+
* Resets the activeTracingFramework. This variable is used for internal testing, and is
24+
* not a valid production scenario.
25+
*/
26+
public static void resetActiveTracingFramework() {
27+
SpannerOptions.resetActiveTracingFramework();
28+
}
29+
}

google-cloud-spanner/src/test/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpcTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import com.google.cloud.spanner.SpannerException;
4747
import com.google.cloud.spanner.SpannerExceptionFactory;
4848
import com.google.cloud.spanner.SpannerOptions;
49+
import com.google.cloud.spanner.SpannerOptionsHelper;
4950
import com.google.cloud.spanner.SpannerOptions.CallContextConfigurator;
5051
import com.google.cloud.spanner.Statement;
5152
import com.google.cloud.spanner.TransactionRunner;
@@ -167,7 +168,7 @@ public static Object[] data() {
167168
@Before
168169
public void startServer() throws IOException {
169170
// Enable OpenTelemetry tracing.
170-
SpannerOptions.resetActiveTracingFramework();
171+
SpannerOptionsHelper.resetActiveTracingFramework();
171172
SpannerOptions.enableOpenTelemetryTraces();
172173

173174
assumeTrue(

0 commit comments

Comments
 (0)