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