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 |
---|
@@ -113,6 +113,10 @@ void setCurrentSpan(Span span) {
|
113 | 113 | currentSpan = span;
|
114 | 114 | }
|
115 | 115 |
|
| 116 | +Span getCurrentSpan() { |
| 117 | +return currentSpan; |
| 118 | +} |
| 119 | + |
116 | 120 | @Override
|
117 | 121 | public long executePartitionedUpdate(Statement stmt, UpdateOption... options) {
|
118 | 122 | setActive(null);
|
|
Original file line number | Diff line number | Diff line change |
---|
|
77 | 77 | import io.opencensus.metrics.Metrics;
|
78 | 78 | import io.opencensus.trace.Annotation;
|
79 | 79 | import io.opencensus.trace.AttributeValue;
|
| 80 | +import io.opencensus.trace.BlankSpan; |
80 | 81 | import io.opencensus.trace.Span;
|
81 | 82 | import io.opencensus.trace.Status;
|
82 | 83 | import io.opencensus.trace.Tracer;
|
@@ -1472,11 +1473,15 @@ public void prepareReadWriteTransaction() {
|
1472 | 1473 |
|
1473 | 1474 | private void keepAlive() {
|
1474 | 1475 | markUsed();
|
| 1476 | +final Span previousSpan = delegate.getCurrentSpan(); |
| 1477 | +delegate.setCurrentSpan(BlankSpan.INSTANCE); |
1475 | 1478 | try (ResultSet resultSet =
|
1476 | 1479 | delegate
|
1477 | 1480 | .singleUse(TimestampBound.ofMaxStaleness(60, TimeUnit.SECONDS))
|
1478 | 1481 | .executeQuery(Statement.newBuilder("SELECT 1").build())) {
|
1479 | 1482 | resultSet.next();
|
| 1483 | +} finally { |
| 1484 | +delegate.setCurrentSpan(previousSpan); |
1480 | 1485 | }
|
1481 | 1486 | }
|
1482 | 1487 |
|
|
You can’t perform that action at this time.
0 commit comments