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_COMMITTED_TXNS: Lazy<IntCounter> = Lazy::new(|| {
15    register_int_counter!(
16        "diem_storage_committed_txns",
17        "Diem storage committed transactions"
18    )
19    .unwrap()
20});
21
22pub static DIEM_STORAGE_LATEST_TXN_VERSION: Lazy<IntGauge> = Lazy::new(|| {
23    register_int_gauge!(
24        "diem_storage_latest_transaction_version",
25        "Diem storage latest transaction version"
26    )
27    .unwrap()
28});
29
30pub static DIEM_STORAGE_LEDGER_VERSION: Lazy<IntGauge> = Lazy::new(|| {
31    register_int_gauge!(
32        "diem_storage_ledger_version",
33        "Version in the latest saved ledger info."
34    )
35    .unwrap()
36});
37
38pub static DIEM_STORAGE_NEXT_BLOCK_EPOCH: Lazy<IntGauge> = Lazy::new(|| {
39    register_int_gauge!(
40        "diem_storage_next_block_epoch",
41        "ledger_info.next_block_epoch() for the latest saved ledger info."
42    )
43    .unwrap()
44});
45
46pub static DIEM_STORAGE_API_LATENCY_SECONDS: Lazy<HistogramVec> =
47    Lazy::new(|| {
48        register_histogram_vec!(
49            // metric name
50            "diem_storage_api_latency_seconds",
51            // metric description
52            "Diem storage api latency in seconds",
53            // metric labels (dimensions)
54            &["api_name", "result"]
55        )
56        .unwrap()
57    });
58
59pub static DIEM_STORAGE_OTHER_TIMERS_SECONDS: Lazy<HistogramVec> =
60    Lazy::new(|| {
61        register_histogram_vec!(
62            // metric name
63            "diem_storage_other_timers_seconds",
64            // metric description
65            "Various timers below public API level.",
66            // metric labels (dimensions)
67            &["name"]
68        )
69        .unwrap()
70    });
71
72/// Rocksdb metrics
73pub static DIEM_STORAGE_ROCKSDB_PROPERTIES: Lazy<IntGaugeVec> =
74    Lazy::new(|| {
75        register_int_gauge_vec!(
76            // metric name
77            "diem_rocksdb_properties",
78            // metric description
79            "rocksdb integer properties",
80            // metric labels (dimensions)
81            &["cf_name", "property_name",]
82        )
83        .unwrap()
84    });