mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-09-25 06:35:34 +00:00
feat: add status label to datanode failed-insert metric (#9191)
* feat: label datanode failed inserts by status Signed-off-by: dhruvxvaishnav <dhruvvaishnav687@gmail.com> * fix: rename failed-insert metric label to code Signed-off-by: dhruvxvaishnav <dhruvvaishnav687@gmail.com> --------- Signed-off-by: dhruvxvaishnav <dhruvvaishnav687@gmail.com> Co-authored-by: Weny Xu <wenymedia@gmail.com>
This commit is contained in:
co-authored by
Weny Xu
parent
0e5bcaee54
commit
2ab8475b84
@@ -17,6 +17,7 @@ use prometheus::*;
|
||||
|
||||
/// Region request type label.
|
||||
pub const REGION_REQUEST_TYPE: &str = "datanode_region_request_type";
|
||||
const REGION_REQUEST_CODE: &str = "code";
|
||||
|
||||
pub const REGION_ROLE: &str = "region_role";
|
||||
pub const REGION_ID: &str = "region_id";
|
||||
@@ -84,11 +85,12 @@ lazy_static! {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
/// Total count of failed insert requests to region server.
|
||||
/// Total count of failed insert requests to region server, labeled with request
|
||||
/// type and status code.
|
||||
pub static ref REGION_SERVER_INSERT_FAIL_COUNT: IntCounterVec = register_int_counter_vec!(
|
||||
"greptime_datanode_region_failed_insert_count",
|
||||
"failed region server insert requests count",
|
||||
&[REGION_REQUEST_TYPE]
|
||||
&[REGION_REQUEST_TYPE, REGION_REQUEST_CODE]
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -687,7 +687,7 @@ impl RegionServer {
|
||||
}
|
||||
Err(err) => {
|
||||
crate::metrics::REGION_SERVER_INSERT_FAIL_COUNT
|
||||
.with_label_values(&[request_type])
|
||||
.with_label_values(&[request_type, err.status_code().as_ref()])
|
||||
.inc_by(batch_size as u64);
|
||||
Err(err)
|
||||
}
|
||||
@@ -1640,7 +1640,7 @@ impl RegionServerInner {
|
||||
Err(err) => {
|
||||
if matches!(region_change, RegionChange::Ingest) {
|
||||
crate::metrics::REGION_SERVER_INSERT_FAIL_COUNT
|
||||
.with_label_values(&[request_type])
|
||||
.with_label_values(&[request_type, err.status_code().as_ref()])
|
||||
.inc();
|
||||
}
|
||||
// Removes the region status if the operation fails.
|
||||
|
||||
Reference in New Issue
Block a user