pos_ledger_db/
metrics.rs

1// Copyright (c) The Diem Core Contributors
2// SPDX-License-Identifier: Apache-2.0
3
4// Copyright 2021 Conflux Foundation. All rights reserved.
5// Conflux is free software and distributed under GNU General Public License.
6// See http://www.gnu.org/licenses/
7
8use diem_metrics::{
9    register_histogram_vec, register_int_counter, register_int_gauge,
10    register_int_gauge_vec, HistogramVec, IntCounter, IntGauge, IntGaugeVec,
11};
12use once_cell::sync::Lazy;
13
14pub static DIEM_STORAGE_LEDGER: Lazy<IntGaugeVec> = Lazy::new(|| {
15    register_int_gauge_vec!(
16        // metric name
17        "diem_storage_ledger",
18        // metric description
19        "Diem storage ledger counters",
20        // metric labels (dimensions)
21        &["type"]
22    )
23    .unwrap()
24});
25
26pub static DIEM_STORAGE_COMMITTED_TXNS: Lazy<IntCounter> = Lazy::new(|| {
27    register_int_counter!(
28        "diem_storage_committed_txns",
29        "Diem storage committed transactions"
30    )
31    .unwrap()
32});
33
34pub static DIEM_STORAGE_LATEST_TXN_VERSION: Lazy<IntGauge> = Lazy::new(|| {
35    register_int_gauge!(
36        "diem_storage_latest_transaction_version",
37        "Diem storage latest transaction version"
38    )
39    .unwrap()
40});
41
42pub static DIEM_STORAGE_LEDGER_VERSION: Lazy<IntGauge> = Lazy::new(|| {
43    register_int_gauge!(
44        "diem_storage_ledger_version",
45        "Version in the latest saved ledger info."
46    )
47    .unwrap()
48});
49
50pub static DIEM_STORAGE_NEXT_BLOCK_EPOCH: Lazy<IntGauge> = Lazy::new(|| {
51    register_int_gauge!(
52        "diem_storage_next_block_epoch",
53        "ledger_info.next_block_epoch() for the latest saved ledger info."
54    )
55    .unwrap()
56});
57
58pub static DIEM_STORAGE_PRUNE_WINDOW: Lazy<IntGauge> = Lazy::new(|| {
59    register_int_gauge!(
60        "diem_storage_prune_window",
61        "Diem storage prune window"
62    )
63    .unwrap()
64});
65
66pub static DIEM_STORAGE_PRUNER_LEAST_READABLE_STATE_VERSION: Lazy<IntGauge> =
67    Lazy::new(|| {
68        register_int_gauge!(
69            "diem_storage_pruner_least_readable_state_version",
70            "Diem storage pruner least readable state version"
71        )
72        .unwrap()
73    });
74
75pub static DIEM_STORAGE_API_LATENCY_SECONDS: Lazy<HistogramVec> =
76    Lazy::new(|| {
77        register_histogram_vec!(
78            // metric name
79            "diem_storage_api_latency_seconds",
80            // metric description
81            "Diem storage api latency in seconds",
82            // metric labels (dimensions)
83            &["api_name", "result"]
84        )
85        .unwrap()
86    });
87
88pub static DIEM_STORAGE_OTHER_TIMERS_SECONDS: Lazy<HistogramVec> =
89    Lazy::new(|| {
90        register_histogram_vec!(
91            // metric name
92            "diem_storage_other_timers_seconds",
93            // metric description
94            "Various timers below public API level.",
95            // metric labels (dimensions)
96            &["name"]
97        )
98        .unwrap()
99    });
100
101/// Rocksdb metrics
102pub static DIEM_STORAGE_ROCKSDB_PROPERTIES: Lazy<IntGaugeVec> =
103    Lazy::new(|| {
104        register_int_gauge_vec!(
105            // metric name
106            "diem_rocksdb_properties",
107            // metric description
108            "rocksdb integer properties",
109            // metric labels (dimensions)
110            &["cf_name", "property_name",]
111        )
112        .unwrap()
113    });
114
115// Backup progress gauges:
116
117pub(crate) static BACKUP_EPOCH_ENDING_EPOCH: Lazy<IntGauge> = Lazy::new(|| {
118    register_int_gauge!(
119        "diem_backup_handler_epoch_ending_epoch",
120        "Current epoch returned in an epoch ending backup."
121    )
122    .unwrap()
123});
124
125pub(crate) static BACKUP_TXN_VERSION: Lazy<IntGauge> = Lazy::new(|| {
126    register_int_gauge!(
127        "diem_backup_handler_transaction_version",
128        "Current version returned in a transaction backup."
129    )
130    .unwrap()
131});
132
133pub(crate) static BACKUP_STATE_SNAPSHOT_VERSION: Lazy<IntGauge> =
134    Lazy::new(|| {
135        register_int_gauge!(
136            "diem_backup_handler_state_snapshot_version",
137            "Version of requested state snapshot backup."
138        )
139        .unwrap()
140    });
141
142pub(crate) static BACKUP_STATE_SNAPSHOT_LEAF_IDX: Lazy<IntGauge> =
143    Lazy::new(|| {
144        register_int_gauge!(
145            "diem_backup_handler_state_snapshot_leaf_index",
146            "Index of current leaf index returned in a state snapshot backup."
147        )
148        .unwrap()
149    });