Skip to content

Commit e89ae27

Browse files
committed
chore: add ready span for BlobReadSession
1 parent 8beaa03 commit e89ae27

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

google-cloud-storage/src/main/java/com/google/cloud/storage/OtelStorageDecorator.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,13 +1472,16 @@ public ApiFuture<BlobReadSession> blobReadSession(BlobId id, BlobSourceOption...
14721472
.startSpan();
14731473
try (Scope ignore1 = blobReadSessionSpan.makeCurrent()) {
14741474
Context blobReadSessionContext = Context.current();
1475+
Span ready = tracer.spanBuilder("blobReadSession/ready").startSpan();
14751476
ApiFuture<BlobReadSession> blobReadSessionApiFuture = delegate.blobReadSession(id, options);
14761477
ApiFuture<BlobReadSession> futureDecorated =
14771478
ApiFutures.transform(
14781479
blobReadSessionApiFuture,
1479-
delegate ->
1480-
new OtelDecoratingBlobReadSession(
1481-
delegate, id, blobReadSessionContext, blobReadSessionSpan),
1480+
delegate -> {
1481+
ready.end();
1482+
return new OtelDecoratingBlobReadSession(
1483+
delegate, id, blobReadSessionContext, blobReadSessionSpan);
1484+
},
14821485
MoreExecutors.directExecutor());
14831486
ApiFutures.addCallback(
14841487
futureDecorated,
@@ -1487,6 +1490,9 @@ public ApiFuture<BlobReadSession> blobReadSession(BlobId id, BlobSourceOption...
14871490
blobReadSessionSpan.recordException(t);
14881491
blobReadSessionSpan.setStatus(StatusCode.ERROR, t.getClass().getSimpleName());
14891492
blobReadSessionSpan.end();
1493+
ready.recordException(t);
1494+
ready.setStatus(StatusCode.ERROR, t.getClass().getSimpleName());
1495+
ready.end();
14901496
},
14911497
MoreExecutors.directExecutor());
14921498
return futureDecorated;
@@ -1498,6 +1504,14 @@ public ApiFuture<BlobReadSession> blobReadSession(BlobId id, BlobSourceOption...
14981504
}
14991505
}
15001506

1507+
@Override
1508+
@TransportCompatibility({Transport.GRPC})
1509+
@BetaApi
1510+
public AppendableBlobUpload appendableBlobUpload(
1511+
BlobInfo blob, int bufferSize, BlobWriteOption... options) throws IOException {
1512+
return delegate.appendableBlobUpload(blob, bufferSize, options);
1513+
}
1514+
15011515
@Override
15021516
public StorageOptions getOptions() {
15031517
return delegate.getOptions();

0 commit comments

Comments
 (0)