Skip to content

Commit

Permalink
fix(storage): Distinguish between unssigned_task and tivival_move_tas…
Browse files Browse the repository at this point in the history
…k in the metrics report (#7742)

In the existing code, if the assignee_context_id is not found, the corresponding task will be reported to the unassigned label, which is confusing.

In this pr, it will distinguish trivival_move_task from unassigned more precisely so that they can be better distinguished in the metrics.

Approved-By: Gun9niR
Approved-By: zwang28
  • Loading branch information
Li0k authored Feb 7, 2023
1 parent ed27ecd commit c8535a6
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/meta/src/hummock/manager/mod.rs
Original file line number Diff line number Diff line change
@@ -1182,7 +1182,7 @@ where
}

let task_status = compact_task.task_status();
let task_label = task_status.as_str_name();
let task_status_label = task_status.as_str_name();
if let Some(context_id) = assignee_context_id {
// A task heartbeat is removed IFF we report the task status of a task and it still has
// a valid assignment, OR we remove the node context from our list of nodes,
@@ -1200,6 +1200,7 @@ where
original_task_num: assigned_task_num,
});
}

// Update compaction task count.
//
// A corner case is that the compactor is deleted
@@ -1212,18 +1213,29 @@ where
.with_label_values(&[
&format!("{}:{}", host.host, host.port),
&compact_task.compaction_group_id.to_string(),
task_label,
task_status_label,
])
.inc();
}
} else {
// Update compaction task count. The task will be marked as `unassigned`.
// There are two cases where assignee_context_id is not available
// 1. compactor does not exist
// 2. trivival_move

let label = if CompactStatus::is_trivial_move_task(compact_task) {
// TODO: only support can_trivial_move in DynamicLevelCompcation, will check
// task_type next PR
"trivial-move"
} else {
"unassigned"
};

self.metrics
.compact_frequency
.with_label_values(&[
"unassigned",
label,
&compact_task.compaction_group_id.to_string(),
task_label,
task_status_label,
])
.inc();
}

0 comments on commit c8535a6

Please sign in to comment.