pub struct TransactionMetrics {
pub metrics: Arc<Mutex<MetricsReport>>,
/* private fields */
}Expand description
Collects the metrics of a transaction, attempt after attempt.
This is the handle shared between the transaction, the runner hooks and the
caller: cloning it clones the handle, not the data. The recording methods
are called by the binding as the transaction progresses, the report is read
back with get_metrics_data.
Fields§
§metrics: Arc<Mutex<MetricsReport>>The report being built.
Implementations§
Source§impl TransactionMetrics
impl TransactionMetrics
Sourcepub fn finish_attempt(&self, outcome: AttemptOutcome)
pub fn finish_attempt(&self, outcome: AttemptOutcome)
Ends the current attempt and pushes it to the report.
Does nothing when no attempt is being recorded, which makes it safe to call on the exit paths of a runner that may already have ended it.
Sourcepub fn set_on_error_duration(&self, duration: Duration)
pub fn set_on_error_duration(&self, duration: Duration)
Records the time spent in on_error for the attempt that just ended.
The runner measures it after on_error returned, hence after the
attempt was pushed: it lands on the last attempt of the report.
Sourcepub fn set_total_duration(&self, duration: Duration)
pub fn set_total_duration(&self, duration: Duration)
Records the total duration of the run.
Sourcepub fn set_read_version(&self, version: i64)
pub fn set_read_version(&self, version: i64)
Records the read version of the current attempt.
Sourcepub fn set_commit_version(&self, version: i64)
pub fn set_commit_version(&self, version: i64)
Records the commit version of the transaction.
Sourcepub fn set_conflicting_keys(&self, keys: ConflictKeys)
pub fn set_conflicting_keys(&self, keys: ConflictKeys)
Records the conflicting key ranges of the current attempt.
Sourcepub fn increment_conflict_count(&self)
pub fn increment_conflict_count(&self)
Increment the conflict counter
Sourcepub fn get_retries(&self) -> u64
pub fn get_retries(&self) -> u64
Get the number of retries
Sourcepub fn get_metrics_data(&self) -> MetricsReport
pub fn get_metrics_data(&self) -> MetricsReport
Returns a clone of the report built so far.
Sourcepub fn get_transaction_info(&self) -> TransactionInfo
pub fn get_transaction_info(&self) -> TransactionInfo
Returns a clone of the transaction information.
Trait Implementations§
Source§impl Clone for TransactionMetrics
impl Clone for TransactionMetrics
Source§fn clone(&self) -> TransactionMetrics
fn clone(&self) -> TransactionMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more