MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / get_statistics

Method get_statistics

graphlite/src/txn/manager.rs:495–519  ·  view source on GitHub ↗

Get transaction statistics

(&self)

Source from the content-addressed store, hash-verified

493
494 /// Get transaction statistics
495 pub fn get_statistics(&self) -> Result<TransactionStatistics, ExecutionError> {
496 let active_txns = self.active_transactions.read().map_err(|_| {
497 ExecutionError::RuntimeError("Failed to acquire transactions lock".to_string())
498 })?;
499
500 let mut stats = TransactionStatistics::default();
501
502 for txn_arc in active_txns.values() {
503 let transaction = txn_arc.lock().map_err(|_| {
504 ExecutionError::RuntimeError("Failed to acquire transaction lock".to_string())
505 })?;
506
507 stats.total_transactions += 1;
508
509 match &transaction.status {
510 super::state::TransactionStatus::Active => stats.active_transactions += 1,
511 super::state::TransactionStatus::Committed => stats.committed_transactions += 1,
512 super::state::TransactionStatus::RolledBack => stats.rolled_back_transactions += 1,
513 super::state::TransactionStatus::Failed(_) => stats.failed_transactions += 1,
514 _ => {}
515 }
516 }
517
518 Ok(stats)
519 }
520}
521
522/// Transaction statistics for monitoring

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected