@@ -110,9 +110,13 @@ public List<Operation> fetchAllPages(CheckpointUpdatedExecutionState checkpointU
110110 }
111111 var nextMarker = checkpointUpdatedExecutionState .nextMarker ();
112112 while (nextMarker != null && !nextMarker .isEmpty ()) {
113+ var startTime = System .nanoTime ();
113114 var response = config .getDurableExecutionClient ()
114115 .getExecutionState (durableExecutionArn , checkpointToken , nextMarker );
115- logger .debug ("Durable API getExecutionState called: {}." , response );
116+ logger .debug (
117+ "Durable getExecutionState API called (latency={}ns): {}." ,
118+ System .nanoTime () - startTime ,
119+ response );
116120 operations .addAll (response .operations ());
117121 nextMarker = response .nextMarker ();
118122 }
@@ -130,9 +134,10 @@ private void doBatchAction(List<OperationUpdate> updates) {
130134 return ;
131135 }
132136
133- logger .debug ("Calling durable API checkpointDurableExecution with {} updates" , request .size ());
137+ var startTime = System .nanoTime ();
138+ logger .debug ("Calling durable checkpoint API with {} updates: {}" , updates .size (), request );
134139 var response = config .getDurableExecutionClient ().checkpoint (durableExecutionArn , checkpointToken , request );
135- logger .debug ("Durable API checkpointDurableExecution called: {}." , response );
140+ logger .debug ("Durable checkpoint API called (latency={}ns) : {}." , System . nanoTime () - startTime , response );
136141
137142 // Notify callback of completion
138143 // TODO: sam local backend returns no new execution state when called with zero
@@ -144,16 +149,26 @@ private void doBatchAction(List<OperationUpdate> updates) {
144149 // fetch all pages of operations
145150 var operations = fetchAllPages (response .newExecutionState ());
146151
152+ var processStartTime = System .nanoTime ();
153+ int completedFutures = 0 ;
154+ logger .debug (
155+ "Processing {} operations. ({} pending pollers)" , operations .size (), pollingFutures .size ());
147156 // call the callback
148157 callback .accept (operations );
149158
150159 // complete the registered pollingFutures
151160 for (var operation : operations ) {
152161 var pollers = pollingFutures .remove (operation .id ());
153162 if (pollers != null ) {
163+ completedFutures += pollers .size ();
154164 pollers .forEach (poller -> poller .complete (operation ));
155165 }
156166 }
167+ logger .debug (
168+ "{} operations processed and {} pollers completed (latency={}ns). " ,
169+ operations .size (),
170+ completedFutures ,
171+ System .nanoTime () - processStartTime );
157172 }
158173 }
159174 }
0 commit comments