1use lazy_static::lazy_static;
16use prometheus::*;
17
18pub const REGION_REQUEST_TYPE: &str = "datanode_region_request_type";
20
21pub const REGION_ROLE: &str = "region_role";
22pub const REGION_ID: &str = "region_id";
23pub const RESULT_TYPE: &str = "result";
24
25lazy_static! {
26 pub static ref HANDLE_REGION_REQUEST_ELAPSED: HistogramVec = register_histogram_vec!(
28 "greptime_datanode_handle_region_request_elapsed",
29 "datanode handle region request elapsed",
30 &[REGION_REQUEST_TYPE]
31 )
32 .unwrap();
33 pub static ref REGION_CHANGED_ROW_COUNT: IntCounterVec = register_int_counter_vec!(
35 "greptime_datanode_region_changed_row_count",
36 "datanode region changed row count",
37 &[REGION_REQUEST_TYPE]
38 )
39 .unwrap();
40 pub static ref LAST_RECEIVED_HEARTBEAT_ELAPSED: IntGauge = register_int_gauge!(
42 "greptime_last_received_heartbeat_lease_elapsed",
43 "last received heartbeat lease elapsed",
44 )
45 .unwrap();
46 pub static ref LAST_SENT_HEARTBEAT_ELAPSED: IntGauge = register_int_gauge!(
48 "greptime_last_sent_heartbeat_lease_elapsed",
49 "last sent heartbeat lease elapsed",
50 )
51 .unwrap();
52 pub static ref LEASE_EXPIRED_REGION: IntGaugeVec = register_int_gauge_vec!(
53 "greptime_lease_expired_region",
54 "lease expired region",
55 &[REGION_ID]
56 )
57 .unwrap();
58 pub static ref HEARTBEAT_REGION_LEASES: IntGaugeVec = register_int_gauge_vec!(
60 "greptime_heartbeat_region_leases",
61 "received region leases via heartbeat",
62 &[REGION_ROLE]
63 )
64 .unwrap();
65 pub static ref HEARTBEAT_SENT_COUNT: IntCounter = register_int_counter!(
67 "greptime_datanode_heartbeat_send_count",
68 "datanode heartbeat sent",
69 )
70 .unwrap();
71 pub static ref HEARTBEAT_RECV_COUNT: IntCounterVec = register_int_counter_vec!(
73 "greptime_datanode_heartbeat_recv_count",
74 "datanode heartbeat received",
75 &[RESULT_TYPE]
76 )
77 .unwrap();
78
79 pub static ref REGION_SERVER_REQUEST_FAILURE_COUNT: IntCounterVec = register_int_counter_vec!(
81 "greptime_datanode_region_request_fail_count",
82 "failed region server requests count",
83 &[REGION_REQUEST_TYPE]
84 )
85 .unwrap();
86
87 pub static ref REGION_SERVER_INSERT_FAIL_COUNT: IntCounterVec = register_int_counter_vec!(
89 "greptime_datanode_region_failed_insert_count",
90 "failed region server insert requests count",
91 &[REGION_REQUEST_TYPE]
92 )
93 .unwrap();
94
95 pub static ref REMOTE_DYN_FILTER_UPDATE_OUTCOME_TOTAL: IntCounterVec = register_int_counter_vec!(
97 "greptime_datanode_remote_dyn_filter_update_outcome_total",
98 "remote dynamic filter update processing outcomes",
99 &["result"]
100 )
101 .unwrap();
102
103 pub static ref REMOTE_DYN_FILTER_UPDATE_DROP_TOTAL: IntCounterVec = register_int_counter_vec!(
105 "greptime_datanode_remote_dyn_filter_update_drop_total",
106 "remote dynamic filter update drops by reason",
107 &["reason"]
108 )
109 .unwrap();
110
111 pub static ref REMOTE_DYN_FILTER_UNREGISTER_TOTAL: IntCounterVec = register_int_counter_vec!(
113 "greptime_datanode_remote_dyn_filter_unregister_total",
114 "remote dynamic filter unregister outcomes",
115 &["result"]
116 )
117 .unwrap();
118
119 pub static ref REMOTE_DYN_FILTER_REGISTRY_ENTRIES: IntGauge = register_int_gauge!(
121 "greptime_datanode_remote_dyn_filter_registry_entries",
122 "current remote dynamic filter registry entry count",
123 )
124 .unwrap();
125
126 pub static ref REMOTE_DYN_FILTER_PAYLOAD_BYTES: Histogram = register_histogram!(
128 "greptime_datanode_remote_dyn_filter_payload_bytes",
129 "remote dynamic filter accepted update payload bytes received",
130 vec![
131 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, 8192.0, 16384.0, 32768.0,
132 65536.0, 131072.0, 262144.0, 524288.0,
133 ]
134 )
135 .unwrap();
136}