Skip to content

Commit

Permalink
do not treat initial tablet metrics values as 0 (ydb-platform#4355)
Browse files Browse the repository at this point in the history
  • Loading branch information
vporyadke authored and MrLolthe1st committed May 28, 2024
1 parent 2906312 commit f99b1c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions ydb/core/tablet/tablet_metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ namespace {
if (value.IsValueReady()) {
auto val = !value.IsValueObsolete(now) ? value.GetValue() : 0;
ui32 levelVal = val / significantChange;
auto& lit = levels[groupId];
if (lit != levelVal || force) {
lit = levelVal;
auto [lit, inserted] = levels.insert({groupId, 0});
if (inserted || lit->second != levelVal || force) {
lit->second = levelVal;
haveChanges = true;
// N.B. keep going so all levels are properly updated
}
Expand Down
10 changes: 5 additions & 5 deletions ydb/core/tablet/tablet_metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ class TResourceMetricsSendState {
const ui64 TabletId;
const ui32 FollowerId;
const TActorId Launcher;
ui32 LevelCPU = 0;
ui32 LevelMemory = 0;
ui32 LevelNetwork = 0;
ui32 LevelStorage = 0;
ui32 LevelIops = 0;
std::optional<ui32> LevelCPU;
std::optional<ui32> LevelMemory;
std::optional<ui32> LevelNetwork;
std::optional<ui32> LevelStorage;
std::optional<ui32> LevelIops;
THashMap<std::pair<TChannel, TGroupId>, ui32> LevelReadThroughput;
THashMap<std::pair<TChannel, TGroupId>, ui32> LevelWriteThroughput;
THashMap<std::pair<TChannel, TGroupId>, ui32> LevelReadIops;
Expand Down

0 comments on commit f99b1c2

Please sign in to comment.