fix skipping of remote disks

This commit is contained in:
serxa 2024-06-10 15:21:18 +00:00
parent 41cca9df1a
commit dcbcfc9ee8

View File

@ -210,28 +210,28 @@ void ServerAsynchronousMetrics::updateImpl(TimePoint update_time, TimePoint curr
auto total = disk->getTotalSpace(); auto total = disk->getTotalSpace();
/// Some disks don't support information about the space. /// Some disks don't support information about the space.
if (!total) if (total)
continue;
auto available = disk->getAvailableSpace();
auto unreserved = disk->getUnreservedSpace();
new_values[fmt::format("DiskTotal_{}", name)] = { *total,
"The total size in bytes of the disk (virtual filesystem). Remote filesystems may not provide this information." };
if (available)
{ {
new_values[fmt::format("DiskUsed_{}", name)] = { *total - *available, auto available = disk->getAvailableSpace();
"Used bytes on the disk (virtual filesystem). Remote filesystems not always provide this information." }; auto unreserved = disk->getUnreservedSpace();
new_values[fmt::format("DiskAvailable_{}", name)] = { *available, new_values[fmt::format("DiskTotal_{}", name)] = { *total,
"Available bytes on the disk (virtual filesystem). Remote filesystems may not provide this information." }; "The total size in bytes of the disk (virtual filesystem). Remote filesystems may not provide this information." };
if (available)
{
new_values[fmt::format("DiskUsed_{}", name)] = { *total - *available,
"Used bytes on the disk (virtual filesystem). Remote filesystems not always provide this information." };
new_values[fmt::format("DiskAvailable_{}", name)] = { *available,
"Available bytes on the disk (virtual filesystem). Remote filesystems may not provide this information." };
}
if (unreserved)
new_values[fmt::format("DiskUnreserved_{}", name)] = { *unreserved,
"Available bytes on the disk (virtual filesystem) without the reservations for merges, fetches, and moves. Remote filesystems may not provide this information." };
} }
if (unreserved)
new_values[fmt::format("DiskUnreserved_{}", name)] = { *unreserved,
"Available bytes on the disk (virtual filesystem) without the reservations for merges, fetches, and moves. Remote filesystems may not provide this information." };
try try
{ {
if (auto s3_client = disk->getS3StorageClient()) if (auto s3_client = disk->getS3StorageClient())