File tree Expand file tree Collapse file tree 3 files changed +35
-3
lines changed
main/java/com/google/cloud/spanner
test/java/com/google/cloud/spanner Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -1409,7 +1409,9 @@ public Builder setEnableExtendedTracing(boolean enableExtendedTracing) {
1409
1409
1410
1410
/**
1411
1411
* 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.
1413
1415
*/
1414
1416
public Builder enableServerSideTracing () {
1415
1417
this .enableServerSideTracing = true ;
@@ -1515,7 +1517,7 @@ public static void enableOpenCensusTraces() {
1515
1517
@ ObsoleteApi (
1516
1518
"The OpenCensus project is deprecated. Use enableOpenTelemetryTraces to switch to OpenTelemetry traces" )
1517
1519
@ VisibleForTesting
1518
- public static void resetActiveTracingFramework () {
1520
+ static void resetActiveTracingFramework () {
1519
1521
activeTracingFramework = null ;
1520
1522
}
1521
1523
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 46
46
import com .google .cloud .spanner .SpannerException ;
47
47
import com .google .cloud .spanner .SpannerExceptionFactory ;
48
48
import com .google .cloud .spanner .SpannerOptions ;
49
+ import com .google .cloud .spanner .SpannerOptionsHelper ;
49
50
import com .google .cloud .spanner .SpannerOptions .CallContextConfigurator ;
50
51
import com .google .cloud .spanner .Statement ;
51
52
import com .google .cloud .spanner .TransactionRunner ;
@@ -167,7 +168,7 @@ public static Object[] data() {
167
168
@ Before
168
169
public void startServer () throws IOException {
169
170
// Enable OpenTelemetry tracing.
170
- SpannerOptions .resetActiveTracingFramework ();
171
+ SpannerOptionsHelper .resetActiveTracingFramework ();
171
172
SpannerOptions .enableOpenTelemetryTraces ();
172
173
173
174
assumeTrue (
You can’t perform that action at this time.
0 commit comments