1use lazy_static::lazy_static;
16use prometheus::*;
17
18pub const REGION_REQUEST_TYPE: &str = "datanode_region_request_type";
20const REGION_REQUEST_CODE: &str = "code";
21
22pub const REGION_ROLE: &str = "region_role";
23pub const REGION_ID: &str = "region_id";
24pub const RESULT_TYPE: &str = "result";
25
26lazy_static! {
27 pub static ref HANDLE_REGION_REQUEST_ELAPSED: HistogramVec = register_histogram_vec!(
29 "greptime_datanode_handle_region_request_elapsed",
30 "datanode handle region request elapsed",
31 &[REGION_REQUEST_TYPE]
32 )
33 .unwrap();
34 pub static ref REGION_CHANGED_ROW_COUNT: IntCounterVec = register_int_counter_vec!(
36 "greptime_datanode_region_changed_row_count",
37 "datanode region changed row count",
38 &[REGION_REQUEST_TYPE]
39 )
40 .unwrap();
41 pub static ref LAST_RECEIVED_HEARTBEAT_ELAPSED: IntGauge = register_int_gauge!(
43 "greptime_last_received_heartbeat_lease_elapsed",
44 "last received heartbeat lease elapsed",
45 )
46 .unwrap();
47 pub static ref LAST_SENT_HEARTBEAT_ELAPSED: IntGauge = register_int_gauge!(
49 "greptime_last_sent_heartbeat_lease_elapsed",
50 "last sent heartbeat lease elapsed",
51 )
52 .unwrap();
53 pub static ref LEASE_EXPIRED_REGION: IntGaugeVec = register_int_gauge_vec!(
54 "greptime_lease_expired_region",
55 "lease expired region",
56 &[REGION_ID]
57 )
58 .unwrap();
59 pub static ref HEARTBEAT_REGION_LEASES: IntGaugeVec = register_int_gauge_vec!(
61 "greptime_heartbeat_region_leases",
62 "received region leases via heartbeat",
63 &[REGION_ROLE]
64 )
65 .unwrap();
66 pub static ref HEARTBEAT_SENT_COUNT: IntCounter = register_int_counter!(
68 "greptime_datanode_heartbeat_send_count",
69 "datanode heartbeat sent",
70 )
71 .unwrap();
72 pub static ref HEARTBEAT_RECV_COUNT: IntCounterVec = register_int_counter_vec!(
74 "greptime_datanode_heartbeat_recv_count",
75 "datanode heartbeat received",
76 &[RESULT_TYPE]
77 )
78 .unwrap();
79
80 pub static ref REGION_SERVER_REQUEST_FAILURE_COUNT: IntCounterVec = register_int_counter_vec!(
82 "greptime_datanode_region_request_fail_count",
83 "failed region server requests count",
84 &[REGION_REQUEST_TYPE]
85 )
86 .unwrap();
87
88 pub static ref REGION_OPEN_FAILURES_TOTAL: IntCounterVec = register_int_counter_vec!(
92 "greptime_datanode_region_open_failures_total",
93 "Failed region open attempts, including retries and all requests in failed engine groups, excluding ignored missing regions",
94 &["engine", "status_code"]
95 )
96 .unwrap();
97
98 pub static ref REGION_SERVER_INSERT_FAIL_COUNT: IntCounterVec = register_int_counter_vec!(
101 "greptime_datanode_region_failed_insert_count",
102 "failed region server insert requests count",
103 &[REGION_REQUEST_TYPE, REGION_REQUEST_CODE]
104 )
105 .unwrap();
106
107 pub static ref REMOTE_DYN_FILTER_UPDATE_OUTCOME_TOTAL: IntCounterVec = register_int_counter_vec!(
109 "greptime_datanode_remote_dyn_filter_update_outcome_total",
110 "remote dynamic filter update processing outcomes",
111 &["result"]
112 )
113 .unwrap();
114
115 pub static ref REMOTE_DYN_FILTER_UPDATE_DROP_TOTAL: IntCounterVec = register_int_counter_vec!(
117 "greptime_datanode_remote_dyn_filter_update_drop_total",
118 "remote dynamic filter update drops by reason",
119 &["reason"]
120 )
121 .unwrap();
122
123 pub static ref REMOTE_DYN_FILTER_UNREGISTER_TOTAL: IntCounterVec = register_int_counter_vec!(
125 "greptime_datanode_remote_dyn_filter_unregister_total",
126 "remote dynamic filter unregister outcomes",
127 &["result"]
128 )
129 .unwrap();
130
131 pub static ref REMOTE_DYN_FILTER_REGISTRY_ENTRIES: IntGauge = register_int_gauge!(
133 "greptime_datanode_remote_dyn_filter_registry_entries",
134 "current remote dynamic filter registry entry count",
135 )
136 .unwrap();
137
138 pub static ref REMOTE_DYN_FILTER_PAYLOAD_BYTES: Histogram = register_histogram!(
140 "greptime_datanode_remote_dyn_filter_payload_bytes",
141 "remote dynamic filter accepted update payload bytes received",
142 vec![
143 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, 8192.0, 16384.0, 32768.0,
144 65536.0, 131072.0, 262144.0, 524288.0,
145 ]
146 )
147 .unwrap();
148}