@@ -281,6 +281,11 @@ private void setFinalResult(
281
281
logServerWarnings (response .warnings );
282
282
}
283
283
callback .onSet (connection , response , info , statement , System .nanoTime () - startTime );
284
+
285
+ tracingInfo .setStatus (
286
+ response .type == Message .Response .Type .ERROR
287
+ ? TracingInfo .StatusCode .ERROR
288
+ : TracingInfo .StatusCode .OK );
284
289
tracingInfo .tracingFinished ();
285
290
} catch (Exception e ) {
286
291
callback .onException (
@@ -290,6 +295,8 @@ private void setFinalResult(
290
295
System .nanoTime () - startTime , /*unused*/
291
296
0 );
292
297
298
+ tracingInfo .recordException (e );
299
+ tracingInfo .setStatus (TracingInfo .StatusCode .ERROR , e .toString ());
293
300
tracingInfo .tracingFinished ();
294
301
}
295
302
}
@@ -315,6 +322,8 @@ private void setFinalException(
315
322
316
323
cancelPendingExecutions (execution );
317
324
325
+ tracingInfo .recordException (exception );
326
+ tracingInfo .setStatus (TracingInfo .StatusCode .ERROR , exception .toString ());
318
327
tracingInfo .tracingFinished ();
319
328
320
329
try {
@@ -327,6 +336,7 @@ private void setFinalException(
327
336
// Triggered when an execution reaches the end of the query plan.
328
337
// This is only a failure if there are no other running executions.
329
338
private void reportNoMoreHosts (SpeculativeExecution execution ) {
339
+ execution .parentTracingInfo .setStatus (TracingInfo .StatusCode .ERROR );
330
340
execution .parentTracingInfo .tracingFinished ();
331
341
runningExecutions .remove (execution );
332
342
if (runningExecutions .isEmpty ())
@@ -669,6 +679,7 @@ void cancel() {
669
679
CancelledSpeculativeExecutionException .INSTANCE ,
670
680
System .nanoTime () - startTime );
671
681
}
682
+ parentTracingInfo .setStatus (TracingInfo .StatusCode .OK );
672
683
parentTracingInfo .tracingFinished ();
673
684
return ;
674
685
} else if (!previous .inProgress
@@ -682,6 +693,7 @@ void cancel() {
682
693
CancelledSpeculativeExecutionException .INSTANCE ,
683
694
System .nanoTime () - startTime );
684
695
}
696
+ parentTracingInfo .setStatus (TracingInfo .StatusCode .OK );
685
697
parentTracingInfo .tracingFinished ();
686
698
return ;
687
699
}
@@ -698,6 +710,7 @@ public Message.Request request() {
698
710
@ Override
699
711
public void onSet (
700
712
Connection connection , Message .Response response , long latency , int retryCount ) {
713
+ currentChildTracingInfo .setStatus (TracingInfo .StatusCode .OK );
701
714
currentChildTracingInfo .tracingFinished ();
702
715
703
716
QueryState queryState = queryStateRef .get ();
@@ -1008,6 +1021,8 @@ public boolean onTimeout(Connection connection, long latency, int retryCount) {
1008
1021
@ Override
1009
1022
public void onException (
1010
1023
Connection connection , Exception exception , long latency , int retryCount ) {
1024
+ currentChildTracingInfo .recordException (exception );
1025
+ currentChildTracingInfo .setStatus (TracingInfo .StatusCode .ERROR );
1011
1026
currentChildTracingInfo .tracingFinished ();
1012
1027
1013
1028
QueryState queryState = queryStateRef .get ();
@@ -1047,6 +1062,7 @@ public void onException(
1047
1062
1048
1063
@ Override
1049
1064
public boolean onTimeout (Connection connection , long latency , int retryCount ) {
1065
+ currentChildTracingInfo .setStatus (TracingInfo .StatusCode .ERROR , "timeout" );
1050
1066
currentChildTracingInfo .tracingFinished ();
1051
1067
1052
1068
QueryState queryState = queryStateRef .get ();
@@ -1090,11 +1106,13 @@ public int retryCount() {
1090
1106
}
1091
1107
1092
1108
private void setFinalException (Connection connection , Exception exception ) {
1109
+ parentTracingInfo .setStatus (TracingInfo .StatusCode .ERROR );
1093
1110
parentTracingInfo .tracingFinished ();
1094
1111
RequestHandler .this .setFinalException (this , connection , exception );
1095
1112
}
1096
1113
1097
1114
private void setFinalResult (Connection connection , Message .Response response ) {
1115
+ parentTracingInfo .setStatus (TracingInfo .StatusCode .OK );
1098
1116
parentTracingInfo .tracingFinished ();
1099
1117
RequestHandler .this .setFinalResult (this , connection , response );
1100
1118
}
0 commit comments