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 INGEST_TASK_FAILURES_TOTAL: IntCounterVec = register_int_counter_vec!(
91 "greptime_datanode_ingest_task_failures_total",
92 "Ingest-task join failures, not failed write entries",
93 &[REGION_REQUEST_TYPE, "reason"]
94 )
95 .unwrap();
96
97 pub static ref REGION_OPEN_FAILURES_TOTAL: IntCounterVec = register_int_counter_vec!(
101 "greptime_datanode_region_open_failures_total",
102 "Failed region open attempts, including retries and all requests in failed engine groups, excluding ignored missing regions",
103 &["engine", "status_code"]
104 )
105 .unwrap();
106
107 pub static ref REGION_SERVER_INSERT_FAIL_COUNT: IntCounterVec = register_int_counter_vec!(
110 "greptime_datanode_region_failed_insert_count",
111 "failed region server insert requests count",
112 &[REGION_REQUEST_TYPE, REGION_REQUEST_CODE]
113 )
114 .unwrap();
115
116 pub static ref REMOTE_DYN_FILTER_UPDATE_OUTCOME_TOTAL: IntCounterVec = register_int_counter_vec!(
118 "greptime_datanode_remote_dyn_filter_update_outcome_total",
119 "remote dynamic filter update processing outcomes",
120 &["result"]
121 )
122 .unwrap();
123
124 pub static ref REMOTE_DYN_FILTER_UPDATE_DROP_TOTAL: IntCounterVec = register_int_counter_vec!(
126 "greptime_datanode_remote_dyn_filter_update_drop_total",
127 "remote dynamic filter update drops by reason",
128 &["reason"]
129 )
130 .unwrap();
131
132 pub static ref REMOTE_DYN_FILTER_UNREGISTER_TOTAL: IntCounterVec = register_int_counter_vec!(
134 "greptime_datanode_remote_dyn_filter_unregister_total",
135 "remote dynamic filter unregister outcomes",
136 &["result"]
137 )
138 .unwrap();
139
140 pub static ref REMOTE_DYN_FILTER_REGISTRY_ENTRIES: IntGauge = register_int_gauge!(
142 "greptime_datanode_remote_dyn_filter_registry_entries",
143 "current remote dynamic filter registry entry count",
144 )
145 .unwrap();
146
147 pub static ref REMOTE_DYN_FILTER_PAYLOAD_BYTES: Histogram = register_histogram!(
149 "greptime_datanode_remote_dyn_filter_payload_bytes",
150 "remote dynamic filter accepted update payload bytes received",
151 vec![
152 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, 8192.0, 16384.0, 32768.0,
153 65536.0, 131072.0, 262144.0, 524288.0,
154 ]
155 )
156 .unwrap();
157}