diff --git a/ydb/core/protos/node_whiteboard.proto b/ydb/core/protos/node_whiteboard.proto index b0a918fe01b5..31f709a421f2 100644 --- a/ydb/core/protos/node_whiteboard.proto +++ b/ydb/core/protos/node_whiteboard.proto @@ -345,6 +345,7 @@ message TSystemStateInfo { optional double CoresUsed = 39; optional uint32 CoresTotal = 40; optional float NetworkUtilization = 41; + optional uint64 NetworkWriteThroughput = 42; } message TEvSystemStateRequest { diff --git a/ydb/core/tablet/node_whiteboard.cpp b/ydb/core/tablet/node_whiteboard.cpp index fbbfefa73433..c76877ae4af5 100644 --- a/ydb/core/tablet/node_whiteboard.cpp +++ b/ydb/core/tablet/node_whiteboard.cpp @@ -74,6 +74,7 @@ class TNodeWhiteboardService : public TActorBootstrapped i64 MaxClockSkewWithPeerUs; ui32 MaxClockSkewPeerId; float MaxNetworkUtilization = 0.0; + ui64 SumNetworkWriteThroughput = 0; NKikimrWhiteboard::TSystemStateInfo SystemStateInfo; THolder TabletIntrospectionData; @@ -568,6 +569,7 @@ class TNodeWhiteboardService : public TActorBootstrapped } // TODO: need better way to calculate network utilization MaxNetworkUtilization = std::max(MaxNetworkUtilization, ev->Get()->Record.GetUtilization()); + SumNetworkWriteThroughput += nodeStateInfo.GetWriteThroughput(); nodeStateInfo.MergeFrom(ev->Get()->Record); nodeStateInfo.SetChangeTime(currentChangeTime); } @@ -1095,6 +1097,7 @@ class TNodeWhiteboardService : public TActorBootstrapped } void Handle(TEvPrivate::TEvUpdateRuntimeStats::TPtr &, const TActorContext &ctx) { + static constexpr TDuration UPDATE_PERIOD = TDuration::Seconds(15); { NKikimrWhiteboard::TSystemStateInfo systemStatsUpdate; TVector loadAverage = GetLoadAverage(); @@ -1120,8 +1123,13 @@ class TNodeWhiteboardService : public TActorBootstrapped MaxNetworkUtilization = 0; } + { + SystemStateInfo.SetNetworkWriteThroughput(SumNetworkWriteThroughput / UPDATE_PERIOD.Seconds()); + SumNetworkWriteThroughput = 0; + } + UpdateSystemState(ctx); - ctx.Schedule(TDuration::Seconds(15), new TEvPrivate::TEvUpdateRuntimeStats()); + ctx.Schedule(UPDATE_PERIOD, new TEvPrivate::TEvUpdateRuntimeStats()); } void Handle(TEvPrivate::TEvCleanupDeadTablets::TPtr &, const TActorContext &ctx) { diff --git a/ydb/core/viewer/protos/viewer.proto b/ydb/core/viewer/protos/viewer.proto index 62602c1d787f..dff4b2d4cbc2 100644 --- a/ydb/core/viewer/protos/viewer.proto +++ b/ydb/core/viewer/protos/viewer.proto @@ -344,6 +344,7 @@ message TClusterInfo { uint64 Hosts = 60; uint64 Tenants = 61; double NetworkUtilization = 62; + uint64 NetworkWriteThroughput = 63; } enum ETenantType { @@ -400,6 +401,7 @@ message TTenant { uint32 CoresTotal = 50; optional NKikimrMemory.TMemoryStats MemoryStats = 51; float NetworkUtilization = 52; + uint64 NetworkWriteThroughput = 53; } message TTenants { diff --git a/ydb/core/viewer/tests/canondata/result.json b/ydb/core/viewer/tests/canondata/result.json index b1a21da9ffb2..af422fd482df 100644 --- a/ydb/core/viewer/tests/canondata/result.json +++ b/ydb/core/viewer/tests/canondata/result.json @@ -1435,6 +1435,7 @@ "MapVersions": "not-empty-object", "MemoryTotal": "not-zero-number-text", "NetworkUtilization": "number", + "NetworkWriteThroughput": "text", "NodesAlive": 3, "NodesTotal": 3, "NumberOfCpus": "not-zero-number", @@ -1504,7 +1505,7 @@ "Name": ".metadata", "Owner": "metadata@system", "ParentPathId": "1", - "PathId": "2", + "PathId": "not-zero-number-text", "PathState": 2, "PathType": 1, "SchemeshardId": "72075186232723360" @@ -1518,7 +1519,7 @@ "Name": "dedicated_db", "Owner": "root@builtin", "ParentPathId": "1", - "PathId": "6", + "PathId": "not-zero-number-text", "PathState": 2, "PathType": 10, "SchemeshardId": "72075186232723360" @@ -1532,7 +1533,7 @@ "Name": "serverless_db", "Owner": "root@builtin", "ParentPathId": "1", - "PathId": "8", + "PathId": "not-zero-number-text", "PathState": 3, "PathType": 10, "SchemeshardId": "72075186232723360" @@ -1546,7 +1547,7 @@ "Name": "shared_db", "Owner": "root@builtin", "ParentPathId": "1", - "PathId": "7", + "PathId": "not-zero-number-text", "PathState": 2, "PathType": 10, "SchemeshardId": "72075186232723360" @@ -1563,7 +1564,7 @@ "DomainDescription": { "DiskSpaceUsage": "not-empty-object", "DomainKey": { - "PathId": "1", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "PQPartitionsInside": "0", @@ -1582,7 +1583,7 @@ "TimeCastBucketsPerMediator": "2" }, "ResourcesDomainKey": { - "PathId": "1", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "SchemeShardId_Depricated": "72075186232723360", @@ -1678,7 +1679,7 @@ "Name": "Root", "Owner": "root", "ParentPathId": "1", - "PathId": "1", + "PathId": "not-zero-number-text", "PathState": 2, "PathSubType": 0, "PathType": 1, @@ -1686,7 +1687,7 @@ "SchemeshardId": "72075186232723360" } }, - "PathId": "1", + "PathId": "not-zero-number-text", "PathOwnerId": "72075186232723360", "Source": 1, "Status": "StatusSuccess" @@ -1705,7 +1706,7 @@ "Name": ".metadata", "Owner": "metadata@system", "ParentPathId": "1", - "PathId": "2", + "PathId": "not-zero-number-text", "PathState": 3, "PathType": 1, "SchemeshardId": "72075186224037897" @@ -1722,7 +1723,7 @@ "DomainDescription": { "DiskSpaceUsage": "not-empty-object", "DomainKey": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "PQPartitionsInside": "0", @@ -1749,7 +1750,7 @@ "TimeCastBucketsPerMediator": "2" }, "ResourcesDomainKey": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "SchemeShardId_Depricated": "72075186232723360", @@ -1775,7 +1776,7 @@ "Name": "Root/dedicated_db", "Owner": "root@builtin", "ParentPathId": "1", - "PathId": "1", + "PathId": "not-zero-number-text", "PathState": 2, "PathSubType": 0, "PathType": 4, @@ -1783,7 +1784,7 @@ "SchemeshardId": "72075186224037897" } }, - "PathId": "1", + "PathId": "not-zero-number-text", "PathOwnerId": "72075186224037897", "Source": 1, "Status": "StatusSuccess" @@ -1805,7 +1806,7 @@ "DomainDescription": { "DiskSpaceUsage": "not-empty-object", "DomainKey": { - "PathId": "8", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "PQPartitionsInside": "0", @@ -1828,7 +1829,7 @@ "TimeCastBucketsPerMediator": "2" }, "ResourcesDomainKey": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "SchemeShardId_Depricated": "72075186232723360", @@ -1856,7 +1857,7 @@ "Name": "Root/serverless_db", "Owner": "root@builtin", "ParentPathId": "1", - "PathId": "1", + "PathId": "not-zero-number-text", "PathState": 2, "PathSubType": 0, "PathType": 4, @@ -1864,7 +1865,7 @@ "SchemeshardId": "72075186224038899" } }, - "PathId": "1", + "PathId": "not-zero-number-text", "PathOwnerId": "72075186224038899", "Source": 1, "Status": "StatusSuccess" @@ -1883,7 +1884,7 @@ "Name": ".metadata", "Owner": "metadata@system", "ParentPathId": "1", - "PathId": "2", + "PathId": "not-zero-number-text", "PathState": 3, "PathType": 1, "SchemeshardId": "72075186224038898" @@ -1900,7 +1901,7 @@ "DomainDescription": { "DiskSpaceUsage": "not-empty-object", "DomainKey": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "PQPartitionsInside": "0", @@ -1927,7 +1928,7 @@ "TimeCastBucketsPerMediator": "2" }, "ResourcesDomainKey": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "SchemeShardId_Depricated": "72075186232723360", @@ -1953,7 +1954,7 @@ "Name": "Root/shared_db", "Owner": "root@builtin", "ParentPathId": "1", - "PathId": "1", + "PathId": "not-zero-number-text", "PathState": 2, "PathSubType": 0, "PathType": 4, @@ -1961,7 +1962,7 @@ "SchemeshardId": "72075186224038898" } }, - "PathId": "1", + "PathId": "not-zero-number-text", "PathOwnerId": "72075186224038898", "Source": 1, "Status": "StatusSuccess" @@ -3567,7 +3568,7 @@ "State": 10, "TabletId": "72075186224037888", "TenantId": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 14 @@ -3583,7 +3584,7 @@ "State": 10, "TabletId": "72075186224037889", "TenantId": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 5 @@ -3599,7 +3600,7 @@ "State": 10, "TabletId": "72075186224037890", "TenantId": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 5 @@ -3615,7 +3616,7 @@ "State": 10, "TabletId": "72075186224037891", "TenantId": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 32 @@ -3631,7 +3632,7 @@ "State": 10, "TabletId": "72075186224037892", "TenantId": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 5 @@ -3647,7 +3648,7 @@ "State": 10, "TabletId": "72075186224037893", "TenantId": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 13 @@ -3663,7 +3664,7 @@ "State": 10, "TabletId": "72075186224037894", "TenantId": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 40 @@ -3679,7 +3680,7 @@ "State": 10, "TabletId": "72075186224037895", "TenantId": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 13 @@ -3695,7 +3696,7 @@ "State": 10, "TabletId": "72075186224037896", "TenantId": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 13 @@ -3711,7 +3712,7 @@ "State": 10, "TabletId": "72075186224037897", "TenantId": { - "PathId": "6", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 16 @@ -3734,7 +3735,7 @@ "State": 10, "TabletId": "72075186224038899", "TenantId": { - "PathId": "8", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 16 @@ -3750,7 +3751,7 @@ "State": 10, "TabletId": "72075186224038900", "TenantId": { - "PathId": "8", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 13 @@ -3766,7 +3767,7 @@ "State": 10, "TabletId": "72075186224038901", "TenantId": { - "PathId": "8", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 5 @@ -3782,7 +3783,7 @@ "State": 10, "TabletId": "72075186224038902", "TenantId": { - "PathId": "8", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 5 @@ -3798,7 +3799,7 @@ "State": 10, "TabletId": "72075186224038903", "TenantId": { - "PathId": "8", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 5 @@ -3814,7 +3815,7 @@ "State": 10, "TabletId": "72075186224038904", "TenantId": { - "PathId": "8", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 32 @@ -3837,7 +3838,7 @@ "State": 10, "TabletId": "72075186224038889", "TenantId": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 14 @@ -3853,7 +3854,7 @@ "State": 10, "TabletId": "72075186224038890", "TenantId": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 40 @@ -3869,7 +3870,7 @@ "State": 10, "TabletId": "72075186224038891", "TenantId": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 5 @@ -3885,7 +3886,7 @@ "State": 10, "TabletId": "72075186224038892", "TenantId": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 5 @@ -3901,7 +3902,7 @@ "State": 10, "TabletId": "72075186224038893", "TenantId": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 32 @@ -3917,7 +3918,7 @@ "State": 10, "TabletId": "72075186224038894", "TenantId": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 13 @@ -3933,7 +3934,7 @@ "State": 10, "TabletId": "72075186224038895", "TenantId": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 13 @@ -3949,7 +3950,7 @@ "State": 10, "TabletId": "72075186224038896", "TenantId": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 13 @@ -3965,7 +3966,7 @@ "State": 10, "TabletId": "72075186224038897", "TenantId": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 5 @@ -3981,7 +3982,7 @@ "State": 10, "TabletId": "72075186224038898", "TenantId": { - "PathId": "7", + "PathId": "not-zero-number-text", "SchemeShard": "72075186232723360" }, "Type": 16 @@ -4129,6 +4130,7 @@ "Metrics": {}, "Name": "/Root", "NetworkUtilization": "number", + "NetworkWriteThroughput": "text", "NodeIds": [ 1 ], @@ -4175,6 +4177,7 @@ "Metrics": "not-empty-object", "Name": "/Root/dedicated_db", "NetworkUtilization": "number", + "NetworkWriteThroughput": "text", "NodeIds": [ 50000 ], @@ -4261,6 +4264,7 @@ "Metrics": "not-empty-object", "Name": "/Root/shared_db", "NetworkUtilization": "number", + "NetworkWriteThroughput": "text", "NodeIds": [ 50001 ], @@ -4327,6 +4331,7 @@ "Metrics": {}, "Name": "/Root", "NetworkUtilization": "number", + "NetworkWriteThroughput": "text", "NodeIds": [ 1 ], @@ -4377,6 +4382,7 @@ "Metrics": "not-empty-object", "Name": "/Root/dedicated_db", "NetworkUtilization": "number", + "NetworkWriteThroughput": "text", "NodeIds": [ 50000 ], @@ -4470,6 +4476,7 @@ "Metrics": "not-empty-object", "Name": "/Root/shared_db", "NetworkUtilization": "number", + "NetworkWriteThroughput": "text", "NodeIds": [ 50001 ], diff --git a/ydb/core/viewer/tests/test.py b/ydb/core/viewer/tests/test.py index 743399bd04f3..8107183f21eb 100644 --- a/ydb/core/viewer/tests/test.py +++ b/ydb/core/viewer/tests/test.py @@ -326,6 +326,7 @@ def normalize_result_nodes(result): 'NetworkUtilization', 'NetworkUtilizationMin', 'NetworkUtilizationMax', + 'NetworkWriteThroughput', 'PingTimeUs', 'PingTimeMinUs', 'PingTimeMaxUs', @@ -375,6 +376,7 @@ def normalize_result_schema(result): 'ACL', 'EffectiveACL', 'CreateTxId', + 'PathId', ]) diff --git a/ydb/core/viewer/viewer_cluster.h b/ydb/core/viewer/viewer_cluster.h index 3a385038e6d3..e1e82b54a22e 100644 --- a/ydb/core/viewer/viewer_cluster.h +++ b/ydb/core/viewer/viewer_cluster.h @@ -347,6 +347,7 @@ class TJsonCluster : public TViewerPipeClient { request->AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kCoresUsedFieldNumber); request->AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kCoresTotalFieldNumber); request->AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kNetworkUtilizationFieldNumber); + request->AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kNetworkWriteThroughputFieldNumber); } void InitTabletWhiteboardRequest(NKikimrWhiteboard::TEvTabletStateRequest* request) { @@ -544,6 +545,9 @@ class TJsonCluster : public TViewerPipeClient { ClusterInfo.SetNetworkUtilization(ClusterInfo.GetNetworkUtilization() + systemState.GetNetworkUtilization()); ++nodesWithNetworkUtilization; } + if (systemState.HasNetworkWriteThroughput()) { + ClusterInfo.SetNetworkWriteThroughput(ClusterInfo.GetNetworkWriteThroughput() + systemState.GetNetworkWriteThroughput()); + } } if (nodesWithNetworkUtilization != 0) { diff --git a/ydb/core/viewer/viewer_tenantinfo.h b/ydb/core/viewer/viewer_tenantinfo.h index a5118d67c67e..ef16d07f47a5 100644 --- a/ydb/core/viewer/viewer_tenantinfo.h +++ b/ydb/core/viewer/viewer_tenantinfo.h @@ -280,6 +280,7 @@ class TJsonTenantInfo : public TViewerPipeClient { request.AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kMemoryStatsFieldNumber); } request.AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kNetworkUtilizationFieldNumber); + request.AddFieldsRequired(NKikimrWhiteboard::TSystemStateInfo::kNetworkWriteThroughputFieldNumber); } void SendWhiteboardSystemStateRequest(const TNodeId nodeId) { @@ -850,6 +851,9 @@ class TJsonTenantInfo : public TViewerPipeClient { tenant.SetNetworkUtilization(tenant.GetNetworkUtilization() + nodeInfo.GetNetworkUtilization()); ++nodesWithNetworkUtilization; } + if (nodeInfo.HasNetworkWriteThroughput()) { + tenant.SetNetworkWriteThroughput(tenant.GetNetworkWriteThroughput() + nodeInfo.GetNetworkWriteThroughput()); + } overall = Max(overall, GetViewerFlag(nodeInfo.GetSystemState())); } tenantNodes.emplace(nodeId);