File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
core/src/main/java/tech/ydb/core/impl
query/src/main/java/tech/ydb/query/impl Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1111import java .util .concurrent .locks .ReentrantLock ;
1212import java .util .stream .Collectors ;
1313
14+ import io .grpc .Context ;
1415import org .slf4j .Logger ;
1516import org .slf4j .LoggerFactory ;
1617
@@ -147,6 +148,9 @@ private void tick() {
147148 private void runDiscovery () {
148149 lastUpdateTime = handler .instant ();
149150 try {
151+ // Execute discovery call outside current context to avoid span propogation
152+ Context ctx = Context .ROOT .fork ();
153+ Context previous = ctx .attach ();
150154 final GrpcTransport transport = handler .createDiscoveryTransport ();
151155 try {
152156 logger .debug ("execute list endpoints on {} with timeout {}" , transport , discoveryTimeout );
@@ -168,6 +172,8 @@ private void runDiscovery() {
168172 } catch (Throwable th ) {
169173 transport .close ();
170174 throw th ;
175+ } finally {
176+ ctx .detach (previous );
171177 }
172178 } catch (Throwable th ) {
173179 handleDiscoveryResult (null , th );
Original file line number Diff line number Diff line change 22
33import java .util .concurrent .CompletableFuture ;
44
5+ import io .grpc .Context ;
6+
57import tech .ydb .core .Result ;
68import tech .ydb .core .grpc .GrpcReadStream ;
79import tech .ydb .core .grpc .GrpcRequestSettings ;
@@ -68,7 +70,14 @@ public CompletableFuture<Result<YdbQuery.DeleteSessionResponse>> deleteSession(
6870
6971 public GrpcReadStream <YdbQuery .SessionState > attachSession (
7072 YdbQuery .AttachSessionRequest request , GrpcRequestSettings settings ) {
71- return transport .readStreamCall (QueryServiceGrpc .getAttachSessionMethod (), settings , request );
73+ // Execute attachSession call outside current context to avoid span propogation
74+ Context ctx = Context .ROOT .fork ();
75+ Context previous = ctx .attach ();
76+ try {
77+ return transport .readStreamCall (QueryServiceGrpc .getAttachSessionMethod (), settings , request );
78+ } finally {
79+ ctx .detach (previous );
80+ }
7281 }
7382
7483 public CompletableFuture <Result <YdbQuery .BeginTransactionResponse >> beginTransaction (
You can’t perform that action at this time.
0 commit comments