Fix disks_total_capacity metric bug (#2988)

Now disks_total_capacity metric is a user specified capacity, but
disks_avail_capacity is the disk's actual available capacity, so
disks_total_capacity may be less than disks_avail_capacity, and
UsedPct on FE may be a negative number as a result.
We'd better to use disk actual capacity for disks_total_capacity metric.
This commit is contained in:
Yingchun Lai
2020-03-02 19:09:50 +08:00
committed by GitHub
parent 511c5eed50
commit aa58cd99d9
4 changed files with 10 additions and 9 deletions

View File

@ -1112,13 +1112,13 @@ void* TaskWorkerPool::_report_disk_state_worker_thread_callback(void* arg_this)
disk.__set_root_path(root_path_info.path);
disk.__set_path_hash(root_path_info.path_hash);
disk.__set_storage_medium(root_path_info.storage_medium);
disk.__set_disk_total_capacity(static_cast<double>(root_path_info.capacity));
disk.__set_disk_total_capacity(static_cast<double>(root_path_info.disk_capacity));
disk.__set_data_used_capacity(static_cast<double>(root_path_info.data_used_capacity));
disk.__set_disk_available_capacity(static_cast<double>(root_path_info.available));
disk.__set_used(root_path_info.is_used);
disks[root_path_info.path] = disk;
DorisMetrics::disks_total_capacity.set_metric(root_path_info.path, root_path_info.capacity);
DorisMetrics::disks_total_capacity.set_metric(root_path_info.path, root_path_info.disk_capacity);
DorisMetrics::disks_avail_capacity.set_metric(root_path_info.path, root_path_info.available);
DorisMetrics::disks_data_used_capacity.set_metric(root_path_info.path, root_path_info.data_used_capacity);
DorisMetrics::disks_state.set_metric(root_path_info.path, root_path_info.is_used ? 1L : 0L);