@@ -207,34 +207,29 @@ def from_result(
207
207
208
208
def update_metrics_from_summary (self ):
209
209
metrics = Metrics .get ()
210
- # Timing metrics
211
- metrics .increment (PLANNING_TIME , self .timing .planning_time_ms )
212
- metrics .increment (PROCESSING_TIME , self .timing .processing_time_ms )
213
- metrics .increment (TOTAL_TIME , self .timing .total_time_ms )
214
- metrics .increment (APOC_TIME , self .timing .apoc_time_ms )
215
-
216
- # Write metrics
217
- metrics .increment (NODES_CREATED , self .write_metrics .nodes_created )
218
- metrics .increment (NODES_DELETED , self .write_metrics .nodes_deleted )
219
- metrics .increment (
220
- RELATIONSHIPS_CREATED , self .write_metrics .relationships_created
221
- )
222
- metrics .increment (
223
- RELATIONSHIPS_DELETED , self .write_metrics .relationships_deleted
224
- )
225
- metrics .increment (PROPERTIES_SET , self .write_metrics .properties_set )
226
- metrics .increment (LABELS_ADDED , self .write_metrics .labels_added )
227
- metrics .increment (LABELS_REMOVED , self .write_metrics .labels_removed )
228
- metrics .increment (CONSTRAINTS_ADDED , self .write_metrics .constraints_added )
229
- metrics .increment (CONSTRAINTS_REMOVED , self .write_metrics .constraints_removed )
230
- metrics .increment (INDEXES_ADDED , self .write_metrics .indexes_added )
231
-
232
- # APOC specific metrics
233
- metrics .increment (WAS_TERMINATED , int (self .was_terminated ))
234
- metrics .increment (RETRIES , self .retries )
235
-
236
- # Error tracking
237
- metrics .increment (ERROR_MESSAGES , len (self .error_messages ))
210
+
211
+ metric_updates : list [tuple [Metric , int ]] = [
212
+ (PLANNING_TIME , self .timing .planning_time_ms ),
213
+ (PROCESSING_TIME , self .timing .processing_time_ms ),
214
+ (TOTAL_TIME , self .timing .total_time_ms + self .timing .processing_time_ms ),
215
+ (APOC_TIME , self .timing .apoc_time_ms ),
216
+ (NODES_CREATED , self .write_metrics .nodes_created ),
217
+ (NODES_DELETED , self .write_metrics .nodes_deleted ),
218
+ (RELATIONSHIPS_CREATED , self .write_metrics .relationships_created ),
219
+ (RELATIONSHIPS_DELETED , self .write_metrics .relationships_deleted ),
220
+ (PROPERTIES_SET , self .write_metrics .properties_set ),
221
+ (LABELS_ADDED , self .write_metrics .labels_added ),
222
+ (LABELS_REMOVED , self .write_metrics .labels_removed ),
223
+ (CONSTRAINTS_ADDED , self .write_metrics .constraints_added ),
224
+ (CONSTRAINTS_REMOVED , self .write_metrics .constraints_removed ),
225
+ (INDEXES_ADDED , self .write_metrics .indexes_added ),
226
+ (INDEXES_REMOVED , self .write_metrics .indexes_removed ),
227
+ (WAS_TERMINATED , int (self .was_terminated )),
228
+ (RETRIES , self .retries ),
229
+ (ERROR_MESSAGES , len (self .error_messages )),
230
+ ]
231
+
232
+ metrics .increment (* metric_updates )
238
233
239
234
240
235
class Neo4jResult :
0 commit comments