File tree
Expand file treeCollapse file tree2 files changed
+9
-0
lines changed google-cloud-spanner/src/main/java/com/google/cloud/spanner
Expand file treeCollapse file tree2 files changed
+9
-0
lines changed Original file line number | Diff line number | Diff line change |
---|
@@ -112,6 +112,10 @@ void setCurrentSpan(Span span) {
|
112 | 112 | currentSpan = span;
|
113 | 113 | }
|
114 | 114 |
|
| 115 | +Span getCurrentSpan() { |
| 116 | +return currentSpan; |
| 117 | +} |
| 118 | + |
115 | 119 | @Override
|
116 | 120 | public long executePartitionedUpdate(Statement stmt) {
|
117 | 121 | setActive(null);
|
|
Original file line number | Diff line number | Diff line change |
---|
|
76 | 76 | import io.opencensus.metrics.Metrics;
|
77 | 77 | import io.opencensus.trace.Annotation;
|
78 | 78 | import io.opencensus.trace.AttributeValue;
|
| 79 | +import io.opencensus.trace.BlankSpan; |
79 | 80 | import io.opencensus.trace.Span;
|
80 | 81 | import io.opencensus.trace.Status;
|
81 | 82 | import io.opencensus.trace.Tracer;
|
@@ -1463,11 +1464,15 @@ public void prepareReadWriteTransaction() {
|
1463 | 1464 |
|
1464 | 1465 | private void keepAlive() {
|
1465 | 1466 | markUsed();
|
| 1467 | +final Span previousSpan = delegate.getCurrentSpan(); |
| 1468 | +delegate.setCurrentSpan(BlankSpan.INSTANCE); |
1466 | 1469 | try (ResultSet resultSet =
|
1467 | 1470 | delegate
|
1468 | 1471 | .singleUse(TimestampBound.ofMaxStaleness(60, TimeUnit.SECONDS))
|
1469 | 1472 | .executeQuery(Statement.newBuilder("SELECT 1").build())) {
|
1470 | 1473 | resultSet.next();
|
| 1474 | +} finally { |
| 1475 | +delegate.setCurrentSpan(previousSpan); |
1471 | 1476 | }
|
1472 | 1477 | }
|
1473 | 1478 |
|
|
You can’t perform that action at this time.
0 commit comments