1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
use prometheus::*;
use prometheus_static_metric::*;
make_static_metric! {
pub label_enum MvccConflictKind {
prewrite_write_conflict,
rolled_back,
commit_lock_not_found,
rollback_committed,
acquire_pessimistic_lock_conflict,
pipelined_acquire_pessimistic_lock_amend_fail,
pipelined_acquire_pessimistic_lock_amend_success,
}
pub label_enum MvccDuplicateCommandKind {
prewrite,
commit,
rollback,
acquire_pessimistic_lock,
}
pub label_enum MvccCheckTxnStatusKind {
rollback,
update_ts,
get_commit_info,
pessimistic_rollback,
}
pub struct MvccConflictCounterVec: IntCounter {
"type" => MvccConflictKind,
}
pub struct MvccDuplicateCmdCounterVec: IntCounter {
"type" => MvccDuplicateCommandKind,
}
pub struct MvccCheckTxnStatusCounterVec: IntCounter {
"type" => MvccCheckTxnStatusKind,
}
}
lazy_static! {
pub static ref MVCC_VERSIONS_HISTOGRAM: Histogram = register_histogram!(
"tikv_storage_mvcc_versions",
"Histogram of versions for each key",
exponential_buckets(1.0, 2.0, 30).unwrap()
)
.unwrap();
pub static ref GC_DELETE_VERSIONS_HISTOGRAM: Histogram = register_histogram!(
"tikv_storage_mvcc_gc_delete_versions",
"Histogram of versions deleted by gc for each key",
exponential_buckets(1.0, 2.0, 30).unwrap()
)
.unwrap();
pub static ref CONCURRENCY_MANAGER_LOCK_DURATION_HISTOGRAM: Histogram = register_histogram!(
"tikv_concurrency_manager_lock_duration",
"Histogram of the duration of lock key in the concurrency manager",
exponential_buckets(1e-7, 2.0, 20).unwrap()
)
.unwrap();
pub static ref MVCC_CONFLICT_COUNTER: MvccConflictCounterVec = {
register_static_int_counter_vec!(
MvccConflictCounterVec,
"tikv_storage_mvcc_conflict_counter",
"Total number of conflict error",
&["type"]
)
.unwrap()
};
pub static ref MVCC_DUPLICATE_CMD_COUNTER_VEC: MvccDuplicateCmdCounterVec = {
register_static_int_counter_vec!(
MvccDuplicateCmdCounterVec,
"tikv_storage_mvcc_duplicate_cmd_counter",
"Total number of duplicated commands",
&["type"]
)
.unwrap()
};
pub static ref MVCC_CHECK_TXN_STATUS_COUNTER_VEC: MvccCheckTxnStatusCounterVec = {
register_static_int_counter_vec!(
MvccCheckTxnStatusCounterVec,
"tikv_storage_mvcc_check_txn_status",
"Counter of different results of check_txn_status",
&["type"]
)
.unwrap()
};
}