mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-25 01:10:37 +00:00
feat: Report disk usage stats to metasrv thru heartbeat (#1167)
* feat: Report disk usage stats to metasrv thru heartbeat Signed-off-by: Zheming Li <nkdudu@126.com> * Update src/catalog/src/error.rs Co-authored-by: fys <40801205+Fengys123@users.noreply.github.com> * Update src/catalog/src/lib.rs Co-authored-by: fys <40801205+Fengys123@users.noreply.github.com> * Update src/mito/src/table.rs Co-authored-by: fys <40801205+Fengys123@users.noreply.github.com> --------- Signed-off-by: Zheming Li <nkdudu@126.com> Co-authored-by: fys <40801205+Fengys123@users.noreply.github.com>
This commit is contained in:
@@ -17,7 +17,7 @@ use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use api::v1::meta::{HeartbeatRequest, HeartbeatResponse, NodeStat, Peer};
|
||||
use catalog::{region_number, CatalogManagerRef};
|
||||
use catalog::{region_stats, CatalogManagerRef};
|
||||
use common_telemetry::{error, info, warn};
|
||||
use meta_client::client::{HeartbeatSender, MetaClient};
|
||||
use snafu::ResultExt;
|
||||
@@ -106,11 +106,11 @@ impl HeartbeatTask {
|
||||
let mut tx = Self::create_streams(&meta_client, running.clone()).await?;
|
||||
common_runtime::spawn_bg(async move {
|
||||
while running.load(Ordering::Acquire) {
|
||||
let region_num = match region_number(&catalog_manager_clone).await {
|
||||
Ok(region_num) => region_num as i64,
|
||||
let (region_num, region_stats) = match region_stats(&catalog_manager_clone).await {
|
||||
Ok(region_stats) => (region_stats.len() as i64, region_stats),
|
||||
Err(e) => {
|
||||
error!("failed to get region number, err: {e:?}");
|
||||
-1
|
||||
error!("failed to get region status, err: {e:?}");
|
||||
(-1, vec![])
|
||||
}
|
||||
};
|
||||
|
||||
@@ -123,6 +123,7 @@ impl HeartbeatTask {
|
||||
region_num,
|
||||
..Default::default()
|
||||
}),
|
||||
region_stats,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user