From 3ba74d77615f34aae3dec061a08a861f2b02fcec Mon Sep 17 00:00:00 2001 From: qkrorlqr Date: Fri, 29 Mar 2024 13:51:25 +0000 Subject: [PATCH] issue-654: limiting the number of volume MetaHistory records displayed on volume monpage --- cloud/blockstore/config/storage.proto | 3 +++ cloud/blockstore/libs/storage/core/config.cpp | 1 + cloud/blockstore/libs/storage/core/config.h | 1 + .../libs/storage/volume/volume_actor_monitoring.cpp | 6 +++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cloud/blockstore/config/storage.proto b/cloud/blockstore/config/storage.proto index 0357703a6df..09874cee8ae 100644 --- a/cloud/blockstore/config/storage.proto +++ b/cloud/blockstore/config/storage.proto @@ -948,4 +948,7 @@ message TStorageServiceConfig // Timeout for attempts to acquire the shadow disk when writes to the source // disk are not blocked (in ms). optional uint32 MaxAcquireShadowDiskTotalTimeoutWhenNonBlocked = 358; + + // Max number of volume MetaHistory records displayed on volume monpage. + optional uint32 VolumeMetaHistoryDisplayedRecordLimit = 359; } diff --git a/cloud/blockstore/libs/storage/core/config.cpp b/cloud/blockstore/libs/storage/core/config.cpp index 0b6eb7e1ec7..979ebe7c9f2 100644 --- a/cloud/blockstore/libs/storage/core/config.cpp +++ b/cloud/blockstore/libs/storage/core/config.cpp @@ -368,6 +368,7 @@ TDuration MSeconds(ui32 value) xxx(VolumeHistoryDuration, TDuration, Days(7) )\ xxx(VolumeHistoryCacheSize, ui32, 100 )\ xxx(DeletedCheckpointHistoryLifetime, TDuration, Days(7) )\ + xxx(VolumeMetaHistoryDisplayedRecordLimit, ui32, 30 )\ \ xxx(BytesPerPartition, ui64, 512_TB )\ xxx(BytesPerPartitionSSD, ui64, 512_GB )\ diff --git a/cloud/blockstore/libs/storage/core/config.h b/cloud/blockstore/libs/storage/core/config.h index 1c3ca0af9b6..b3f5d5b0f38 100644 --- a/cloud/blockstore/libs/storage/core/config.h +++ b/cloud/blockstore/libs/storage/core/config.h @@ -395,6 +395,7 @@ class TStorageConfig TDuration GetVolumeHistoryDuration() const; ui32 GetVolumeHistoryCacheSize() const; + ui32 GetVolumeMetaHistoryDisplayedRecordLimit() const; ui64 GetBytesPerPartition() const; ui64 GetBytesPerPartitionSSD() const; diff --git a/cloud/blockstore/libs/storage/volume/volume_actor_monitoring.cpp b/cloud/blockstore/libs/storage/volume/volume_actor_monitoring.cpp index 4b0537cfcc7..d846f6cfafd 100644 --- a/cloud/blockstore/libs/storage/volume/volume_actor_monitoring.cpp +++ b/cloud/blockstore/libs/storage/volume/volume_actor_monitoring.cpp @@ -614,7 +614,10 @@ void TVolumeActor::RenderHistory( } } auto it = metaHistory.rbegin(); - while (it != metaHistory.rend()) { + ui32 displayedCount = 0; + const ui32 limit = + Config->GetVolumeMetaHistoryDisplayedRecordLimit(); + while (it != metaHistory.rend() && displayedCount < limit) { const auto& item = *it; TABLER() { @@ -627,6 +630,7 @@ void TVolumeActor::RenderHistory( } ++it; + ++displayedCount; } } }