diff --git a/cloud/blockstore/libs/storage/core/disk_counters.cpp b/cloud/blockstore/libs/storage/core/disk_counters.cpp index 24dd9bba2eb..60f8aef8e2e 100644 --- a/cloud/blockstore/libs/storage/core/disk_counters.cpp +++ b/cloud/blockstore/libs/storage/core/disk_counters.cpp @@ -34,6 +34,16 @@ void TPartitionDiskCounters::Add(const TPartitionDiskCounters& source) auto& counter = meta.GetValue(Histogram); counter.Add(meta.GetValue(source.Histogram)); } + + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(Rdma); + counter.Add(meta.GetValue(source.Rdma)); + } + + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(Interconnect); + counter.Add(meta.GetValue(source.Interconnect)); + } } void TPartitionDiskCounters::AggregateWith(const TPartitionDiskCounters& source) @@ -62,6 +72,16 @@ void TPartitionDiskCounters::AggregateWith(const TPartitionDiskCounters& source) auto& counter = meta.GetValue(Histogram); counter.AggregateWith(meta.GetValue(source.Histogram)); } + + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(Rdma); + counter.AggregateWith(meta.GetValue(source.Rdma)); + } + + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(Interconnect); + counter.AggregateWith(meta.GetValue(source.Interconnect)); + } } void TPartitionDiskCounters::Publish(TInstant now) @@ -116,6 +136,25 @@ void TPartitionDiskCounters::Publish(TInstant now) } } + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(Rdma); + if (Policy == EPublishingPolicy::All || + counter.PublishingPolicy == EPublishingPolicy::All || + Policy == counter.PublishingPolicy) + { + counter.Publish(); + } + } + + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(Interconnect); + if (Policy == EPublishingPolicy::All || + counter.PublishingPolicy == EPublishingPolicy::All || + Policy == counter.PublishingPolicy) + { + counter.Publish(); + } + } Reset(); } @@ -184,6 +223,30 @@ void TPartitionDiskCounters::Register( aggregate); } } + + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(Rdma); + if (Policy == EPublishingPolicy::All || + counter.PublishingPolicy == EPublishingPolicy::All || + Policy == counter.PublishingPolicy) + { + counter.Register( + counters->GetSubgroup("request", TString(meta.Name)), + requestCounterOptions | counter.CounterOption); + } + } + + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(Interconnect); + if (Policy == EPublishingPolicy::All || + counter.PublishingPolicy == EPublishingPolicy::All || + Policy == counter.PublishingPolicy) + { + counter.Register( + counters->GetSubgroup("request", TString(meta.Name)), + requestCounterOptions | counter.CounterOption); + } + } } void TPartitionDiskCounters::Reset() @@ -212,6 +275,16 @@ void TPartitionDiskCounters::Reset() auto& counter = meta.GetValue(Histogram); counter.Reset(); } + + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(Rdma); + counter.Reset(); + } + + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(Interconnect); + counter.Reset(); + } } //////////////////////////////////////////////////////////////////////////////// @@ -345,6 +418,69 @@ void TVolumeSelfCounters::Publish(TInstant now) //////////////////////////////////////////////////////////////////////////////// +void TTransportDiskCounters::Add(const TTransportDiskCounters& source) +{ + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(RequestCounters); + counter.Add(meta.GetValue(source.RequestCounters)); + } +} + +void TTransportDiskCounters::AggregateWith(const TTransportDiskCounters& source) +{ + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(RequestCounters); + counter.AggregateWith(meta.GetValue(source.RequestCounters)); + } +} + +void TTransportDiskCounters::Publish() +{ + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(RequestCounters); + if (Policy == EPublishingPolicy::All || + counter.PublishingPolicy == EPublishingPolicy::All || + Policy == counter.PublishingPolicy) + { + counter.Publish(); + } + } + Reset(); +} + +void TTransportDiskCounters::Register( + NMonitoring::TDynamicCountersPtr counters, + bool aggregate) +{ + ERequestCounterOptions requestCounterOptions; + if (aggregate) { + requestCounterOptions = + requestCounterOptions | ERequestCounterOption::ReportHistogram; + } + + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(RequestCounters); + if (Policy == EPublishingPolicy::All || + counter.PublishingPolicy == EPublishingPolicy::All || + Policy == counter.PublishingPolicy) + { + counter.Register( + counters->GetSubgroup("request", TString(meta.Name)), + requestCounterOptions | counter.CounterOption); + } + } +} + +void TTransportDiskCounters::Reset() +{ + for (auto meta: TTransportRequestCounters::AllCounters) { + auto& counter = meta.GetValue(RequestCounters); + counter.Reset(); + } +} + +//////////////////////////////////////////////////////////////////////////////// + TVolumeSelfCountersPtr CreateVolumeSelfCounters(EPublishingPolicy policy) { return std::make_unique(policy); diff --git a/cloud/blockstore/libs/storage/core/disk_counters.h b/cloud/blockstore/libs/storage/core/disk_counters.h index c9717700512..013cdb5dd29 100644 --- a/cloud/blockstore/libs/storage/core/disk_counters.h +++ b/cloud/blockstore/libs/storage/core/disk_counters.h @@ -636,6 +636,27 @@ static_assert( sizeof(TVolumeSelfRequestCounters::TCounter) * std::size(TVolumeSelfRequestCounters::AllCounters)); +struct TTransportRequestCounters +{ + using TCounter = + TMemberWithMeta>>; + using TMeta = TMemberMeta; + + TCounter TransportReadBlocks{EPublishingPolicy::All}; + TCounter TransportWriteBlocks{ + EPublishingPolicy::All + }; + + static constexpr TMeta AllCounters[] = { + MakeMeta<&TTransportRequestCounters::TransportReadBlocks>(), + MakeMeta<&TTransportRequestCounters::TransportWriteBlocks>(), + }; +}; + +static_assert( + sizeof(TTransportRequestCounters) == + (sizeof(TTransportRequestCounters::TCounter) * + std::size(TTransportRequestCounters::AllCounters))); //////////////////////////////////////////////////////////////////////////////// struct TPartitionDiskCounters @@ -644,6 +665,8 @@ struct TPartitionDiskCounters TCumulativeDiskCounters Cumulative; THistogramRequestCounters RequestCounters; THistogramCounters Histogram; + TTransportRequestCounters Rdma; + TTransportRequestCounters Interconnect; EPublishingPolicy Policy; @@ -681,6 +704,25 @@ struct TVolumeSelfCounters //////////////////////////////////////////////////////////////////////////////// +struct TTransportDiskCounters +{ + TTransportRequestCounters RequestCounters; + + EPublishingPolicy Policy; + + explicit TTransportDiskCounters(EPublishingPolicy policy) + : Policy(policy) + {} + + void Add(const TTransportDiskCounters& source); + void AggregateWith(const TTransportDiskCounters& source); + void Register(NMonitoring::TDynamicCountersPtr counters, bool aggregate); + void Publish(); + void Reset(); +}; + +//////////////////////////////////////////////////////////////////////////////// + using TPartitionDiskCountersPtr = std::unique_ptr; using TVolumeSelfCountersPtr = std::unique_ptr; diff --git a/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_actor_readblocks.cpp b/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_actor_readblocks.cpp index 6231cc9ccf2..4cbaf722e0a 100644 --- a/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_actor_readblocks.cpp +++ b/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_actor_readblocks.cpp @@ -373,6 +373,7 @@ void TNonreplicatedPartitionActor::HandleReadBlocksCompleted( const auto time = CyclesToDurationSafe(msg->TotalCycles).MicroSeconds(); PartCounters->RequestCounters.ReadBlocks.AddRequest(time, requestBytes); + PartCounters->Interconnect.TransportReadBlocks.AddRequest(time, requestBytes); PartCounters->RequestCounters.ReadBlocks.RequestNonVoidBytes += static_cast(msg->NonVoidBlockCount) * PartConfig->GetBlockSize(); PartCounters->RequestCounters.ReadBlocks.RequestVoidBytes += diff --git a/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_actor_writeblocks.cpp b/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_actor_writeblocks.cpp index 28c765815f6..fc6002d48e6 100644 --- a/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_actor_writeblocks.cpp +++ b/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_actor_writeblocks.cpp @@ -480,6 +480,7 @@ void TNonreplicatedPartitionActor::HandleWriteBlocksCompleted( * PartConfig->GetBlockSize(); const auto time = CyclesToDurationSafe(msg->TotalCycles).MicroSeconds(); PartCounters->RequestCounters.WriteBlocks.AddRequest(time, requestBytes); + PartCounters->Interconnect.TransportWriteBlocks.AddRequest(time, requestBytes); NetworkBytes += requestBytes; CpuUsage += CyclesToDurationSafe(msg->ExecCycles); diff --git a/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_rdma_actor.cpp b/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_rdma_actor.cpp index f184788661c..947723bc547 100644 --- a/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_rdma_actor.cpp +++ b/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_rdma_actor.cpp @@ -340,6 +340,8 @@ void TNonreplicatedPartitionRdmaActor::HandleReadBlocksCompleted( * PartConfig->GetBlockSize(); const auto time = CyclesToDurationSafe(msg->TotalCycles).MicroSeconds(); PartCounters->RequestCounters.ReadBlocks.AddRequest(time, requestBytes); + PartCounters->Rdma.TransportReadBlocks.AddRequest(time, requestBytes); + PartCounters->RequestCounters.ReadBlocks.RequestNonVoidBytes += static_cast(msg->NonVoidBlockCount) * PartConfig->GetBlockSize(); PartCounters->RequestCounters.ReadBlocks.RequestVoidBytes += @@ -371,6 +373,7 @@ void TNonreplicatedPartitionRdmaActor::HandleWriteBlocksCompleted( * PartConfig->GetBlockSize(); const auto time = CyclesToDurationSafe(msg->TotalCycles).MicroSeconds(); PartCounters->RequestCounters.WriteBlocks.AddRequest(time, requestBytes); + PartCounters->Rdma.TransportWriteBlocks.AddRequest(time, requestBytes); NetworkBytes += requestBytes; CpuUsage += CyclesToDurationSafe(msg->ExecCycles); diff --git a/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_rdma_ut.cpp b/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_rdma_ut.cpp index bab82b58ecb..9f213923a23 100644 --- a/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_rdma_ut.cpp +++ b/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_rdma_ut.cpp @@ -309,6 +309,8 @@ Y_UNIT_TEST_SUITE(TNonreplicatedPartitionRdmaTest) runtime.DispatchEvents({}, TDuration::Seconds(1)); auto& counters = env.StorageStatsServiceState->Counters.RequestCounters; + auto& rdmaCounters = env.StorageStatsServiceState->Counters.Rdma; + UNIT_ASSERT_VALUES_EQUAL(3, counters.ReadBlocks.Count); UNIT_ASSERT_VALUES_EQUAL( DefaultBlockSize * ( @@ -324,6 +326,19 @@ Y_UNIT_TEST_SUITE(TNonreplicatedPartitionRdmaTest) counters.WriteBlocks.RequestBytes ); + UNIT_ASSERT_VALUES_EQUAL( + rdmaCounters.TransportReadBlocks.Count, + counters.ReadBlocks.Count); + UNIT_ASSERT_VALUES_EQUAL( + rdmaCounters.TransportWriteBlocks.Count, + counters.WriteBlocks.Count); + UNIT_ASSERT_VALUES_EQUAL( + rdmaCounters.TransportReadBlocks.RequestBytes, + counters.ReadBlocks.RequestBytes); + UNIT_ASSERT_VALUES_EQUAL( + rdmaCounters.TransportWriteBlocks.RequestBytes, + counters.WriteBlocks.RequestBytes); + UNIT_ASSERT_VALUES_EQUAL( 0, env.StorageStatsServiceState->Counters.Simple.IORequestsInFlight.Value @@ -386,6 +401,7 @@ Y_UNIT_TEST_SUITE(TNonreplicatedPartitionRdmaTest) runtime.DispatchEvents({}, TDuration::Seconds(1)); auto& counters = env.StorageStatsServiceState->Counters.RequestCounters; + auto& rdmaCounters = env.StorageStatsServiceState->Counters.Rdma; UNIT_ASSERT_VALUES_EQUAL(2, counters.ReadBlocks.Count); UNIT_ASSERT_VALUES_EQUAL( DefaultBlockSize * ( @@ -401,6 +417,19 @@ Y_UNIT_TEST_SUITE(TNonreplicatedPartitionRdmaTest) counters.WriteBlocks.RequestBytes ); + UNIT_ASSERT_VALUES_EQUAL( + rdmaCounters.TransportReadBlocks.Count, + counters.ReadBlocks.Count); + UNIT_ASSERT_VALUES_EQUAL( + rdmaCounters.TransportWriteBlocks.Count, + counters.WriteBlocks.Count); + UNIT_ASSERT_VALUES_EQUAL( + rdmaCounters.TransportReadBlocks.RequestBytes, + counters.ReadBlocks.RequestBytes); + UNIT_ASSERT_VALUES_EQUAL( + rdmaCounters.TransportWriteBlocks.RequestBytes, + counters.WriteBlocks.RequestBytes); + UNIT_ASSERT_VALUES_EQUAL( 0, env.StorageStatsServiceState->Counters.Simple.IORequestsInFlight.Value diff --git a/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_ut.cpp b/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_ut.cpp index c5c6d563c18..b1970ef4d1e 100644 --- a/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_ut.cpp +++ b/cloud/blockstore/libs/storage/partition_nonrepl/part_nonrepl_ut.cpp @@ -427,6 +427,11 @@ Y_UNIT_TEST_SUITE(TNonreplicatedPartitionTest) runtime.DispatchEvents({}, TDuration::Seconds(1)); auto& counters = env.StorageStatsServiceState->Counters.RequestCounters; + auto& transportCounters = + env.StorageStatsServiceState->Counters.Interconnect; + UNIT_ASSERT_VALUES_EQUAL( + transportCounters.TransportReadBlocks.Count, + counters.ReadBlocks.Count); UNIT_ASSERT_VALUES_EQUAL(2, counters.ReadBlocks.Count); UNIT_ASSERT_VALUES_EQUAL( DefaultBlockSize * ( @@ -493,6 +498,11 @@ Y_UNIT_TEST_SUITE(TNonreplicatedPartitionTest) runtime.DispatchEvents({}, TDuration::Seconds(1)); auto& counters = env.StorageStatsServiceState->Counters.RequestCounters; + auto& transportCounters = + env.StorageStatsServiceState->Counters.Interconnect; + UNIT_ASSERT_VALUES_EQUAL( + transportCounters.TransportWriteBlocks.Count, + counters.WriteBlocks.Count); UNIT_ASSERT_VALUES_EQUAL(1, counters.WriteBlocks.Count); UNIT_ASSERT_VALUES_EQUAL( DefaultBlockSize * 3072, diff --git a/cloud/blockstore/libs/storage/stats_service/stats_service_actor.cpp b/cloud/blockstore/libs/storage/stats_service/stats_service_actor.cpp index 271150dc38d..fa918c0b8fc 100644 --- a/cloud/blockstore/libs/storage/stats_service/stats_service_actor.cpp +++ b/cloud/blockstore/libs/storage/stats_service/stats_service_actor.cpp @@ -71,6 +71,23 @@ void TStatsServiceActor::RegisterCounters(const TActorContext& ctx) State.GetSsdBlobCounters().Register(ssdCounters); State.GetHddBlobCounters().Register(hddCounters); + State.GetRdmaSsdNonreplCounters().Register( + ssdNonreplCounters->GetSubgroup("transport", "RDMA")); + State.GetInterconnectSsdNonreplCounters().Register( + ssdNonreplCounters->GetSubgroup("transport", "Interconnect")); + State.GetRdmaHddNonreplCounters().Register( + hddNonreplCounters->GetSubgroup("transport", "RDMA")); + State.GetInterconnectHddNonreplCounters().Register( + hddNonreplCounters->GetSubgroup("transport", "Interconnect")); + State.GetRdmaSsdMirror2Counters().Register( + ssdMirror2Counters->GetSubgroup("transport", "RDMA")); + State.GetInterconnectSsdMirror2Counters().Register( + ssdMirror2Counters->GetSubgroup("transport", "Interconnect")); + State.GetRdmaSsdMirror3Counters().Register( + ssdMirror3Counters->GetSubgroup("transport", "RDMA")); + State.GetInterconnectSsdMirror3Counters().Register( + ssdMirror3Counters->GetSubgroup("transport", "Interconnect")); + YDbFailedRequests = totalCounters->GetCounter("Ydb/FailedRequests", true); FailedPartitionBoots = totalCounters->GetCounter("FailedBoots", true); diff --git a/cloud/blockstore/libs/storage/stats_service/stats_service_actor_solomon.cpp b/cloud/blockstore/libs/storage/stats_service/stats_service_actor_solomon.cpp index b27e9630495..6236db75510 100644 --- a/cloud/blockstore/libs/storage/stats_service/stats_service_actor_solomon.cpp +++ b/cloud/blockstore/libs/storage/stats_service/stats_service_actor_solomon.cpp @@ -310,6 +310,24 @@ void TStatsServiceActor::HandleVolumePartCounters( State.GetCounters(volume->VolumeInfo).UpdatePartCounters(*msg->DiskCounters); + const auto mediaKind = volume->VolumeInfo.GetStorageMediaKind(); + + if (volume->IsDiskRegistryBased() && mediaKind != STORAGE_MEDIA_SSD_LOCAL) { + auto& rdmaCounter = State.GetRdmaCounter(mediaKind); + auto& interconnectCounter = State.GetInterconnectCounter(mediaKind); + + rdmaCounter.PartAcc.RequestCounters.TransportReadBlocks.Add( + msg->DiskCounters->Rdma.TransportReadBlocks); + rdmaCounter.PartAcc.RequestCounters.TransportWriteBlocks.Add( + msg->DiskCounters->Rdma.TransportWriteBlocks); + interconnectCounter.PartAcc.RequestCounters.TransportReadBlocks.Add( + msg->DiskCounters->Interconnect.TransportReadBlocks); + interconnectCounter.PartAcc.RequestCounters.TransportWriteBlocks.Add( + msg->DiskCounters->Interconnect.TransportWriteBlocks); + + rdmaCounter.Publish(); + interconnectCounter.Publish(); + } if (ev->Sender.NodeId() == SelfId().NodeId()) { State.GetLocalVolumesCounters().UpdateCounters(*msg->DiskCounters); } else { diff --git a/cloud/blockstore/libs/storage/stats_service/stats_service_state.cpp b/cloud/blockstore/libs/storage/stats_service/stats_service_state.cpp index 6d5f5b8d5cb..b133d22902a 100644 --- a/cloud/blockstore/libs/storage/stats_service/stats_service_state.cpp +++ b/cloud/blockstore/libs/storage/stats_service/stats_service_state.cpp @@ -56,6 +56,23 @@ void TTotalCounters::UpdateVolumeSelfCounters(const TVolumeSelfCounters& source) //////////////////////////////////////////////////////////////////////////////// +void TTransportCounters::Register(NMonitoring::TDynamicCountersPtr counters) +{ + PartAcc.Register(counters, true); +} + +void TTransportCounters::Reset() +{ + PartAcc.Reset(); +} + +void TTransportCounters::Publish() +{ + PartAcc.Publish(); +} + +//////////////////////////////////////////////////////////////////////////////// + void TVolumeRequestCounters::Register(NMonitoring::TDynamicCountersPtr counters) { ReadCount.Register(counters->GetSubgroup("request", "ReadBlocks"), "Count"); diff --git a/cloud/blockstore/libs/storage/stats_service/stats_service_state.h b/cloud/blockstore/libs/storage/stats_service/stats_service_state.h index c002c759e2e..4b95235fb9f 100644 --- a/cloud/blockstore/libs/storage/stats_service/stats_service_state.h +++ b/cloud/blockstore/libs/storage/stats_service/stats_service_state.h @@ -75,6 +75,20 @@ struct TTotalCounters //////////////////////////////////////////////////////////////////////////////// +struct TTransportCounters +{ + TTransportDiskCounters PartAcc; + + TTransportCounters(EPublishingPolicy policy) + : PartAcc(policy){}; + + void Register(NMonitoring::TDynamicCountersPtr counters); + void Reset(); + void Publish(); +}; + +//////////////////////////////////////////////////////////////////////////////// + struct TVolumeRequestCounters { TCumulativeCounter ReadCount; @@ -172,6 +186,18 @@ class TStatsServiceState TTotalCounters SsdLocal; TTotalCounters SsdSystem; TTotalCounters HddSystem; + TTransportCounters RdmaSsdNonrepl{EPublishingPolicy::DiskRegistryBased}; + TTransportCounters RdmaHddNonrepl{EPublishingPolicy::DiskRegistryBased}; + TTransportCounters RdmaSsdMirror2{EPublishingPolicy::DiskRegistryBased}; + TTransportCounters RdmaSsdMirror3{EPublishingPolicy::DiskRegistryBased}; + TTransportCounters InterconnectSsdNonrepl{ + EPublishingPolicy::DiskRegistryBased}; + TTransportCounters InterconnectHddNonrepl{ + EPublishingPolicy::DiskRegistryBased}; + TTransportCounters InterconnectSsdMirror2{ + EPublishingPolicy::DiskRegistryBased}; + TTransportCounters InterconnectSsdMirror3{ + EPublishingPolicy::DiskRegistryBased}; TVolumeRequestCounters LocalVolumes; TVolumeRequestCounters NonlocalVolumes; @@ -275,6 +301,46 @@ class TStatsServiceState return HddSystem; } + TTransportCounters& GetRdmaSsdNonreplCounters() + { + return RdmaSsdNonrepl; + } + + TTransportCounters& GetRdmaHddNonreplCounters() + { + return RdmaHddNonrepl; + } + + TTransportCounters& GetRdmaSsdMirror2Counters() + { + return RdmaSsdMirror2; + } + + TTransportCounters& GetRdmaSsdMirror3Counters() + { + return RdmaSsdMirror3; + } + + TTransportCounters& GetInterconnectSsdNonreplCounters() + { + return InterconnectSsdNonrepl; + } + + TTransportCounters& GetInterconnectHddNonreplCounters() + { + return InterconnectHddNonrepl; + } + + TTransportCounters& GetInterconnectSsdMirror2Counters() + { + return InterconnectSsdMirror2; + } + + TTransportCounters& GetInterconnectSsdMirror3Counters() + { + return InterconnectSsdMirror3; + } + TTotalCounters& GetCounters( bool isSystem, const NProto::EStorageMediaKind mediaKind) @@ -303,6 +369,54 @@ class TStatsServiceState return GetCounters(volume.GetIsSystem(), volume.GetStorageMediaKind()); } + TTransportCounters& GetRdmaCounter( + const NCloud::NProto::EStorageMediaKind mediaKind) + { + switch (mediaKind) { + case NCloud::NProto::STORAGE_MEDIA_SSD_NONREPLICATED: + return RdmaSsdNonrepl; + case NCloud::NProto::STORAGE_MEDIA_HDD_NONREPLICATED: + return RdmaHddNonrepl; + case NCloud::NProto::STORAGE_MEDIA_SSD_MIRROR2: + return RdmaSsdMirror2; + case NCloud::NProto::STORAGE_MEDIA_SSD_MIRROR3: + return RdmaSsdMirror3; + default: { + // This function is called only in one place, and before it + // there are checks volume->IsDiskRegistryBased() and + // MediaKind != STORAGE_MEDIA_SSD_LOCAL + Y_ABORT( + "unsupported media kind: %u, transport counters can only " + "be used with disk registry based volumes", + static_cast(mediaKind)); + } + } + } + + TTransportCounters& GetInterconnectCounter( + const NCloud::NProto::EStorageMediaKind mediaKind) + { + switch (mediaKind) { + case NCloud::NProto::STORAGE_MEDIA_SSD_NONREPLICATED: + return InterconnectSsdNonrepl; + case NCloud::NProto::STORAGE_MEDIA_HDD_NONREPLICATED: + return InterconnectHddNonrepl; + case NCloud::NProto::STORAGE_MEDIA_SSD_MIRROR2: + return InterconnectSsdMirror2; + case NCloud::NProto::STORAGE_MEDIA_SSD_MIRROR3: + return InterconnectSsdMirror3; + default: { + // This function is called only in one place, and before it + // there are checks volume->IsDiskRegistryBased() and + // MediaKind != STORAGE_MEDIA_SSD_LOCAL + Y_ABORT( + "unsupported media kind: %u, transport counters can only " + "be used with disk registry based volumes", + static_cast(mediaKind)); + } + } + } + TVolumeRequestCounters& GetLocalVolumesCounters() { return LocalVolumes; diff --git a/cloud/blockstore/libs/storage/volume/volume_ut_stats.cpp b/cloud/blockstore/libs/storage/volume/volume_ut_stats.cpp index aa658155c62..f0340393cfb 100644 --- a/cloud/blockstore/libs/storage/volume/volume_ut_stats.cpp +++ b/cloud/blockstore/libs/storage/volume/volume_ut_stats.cpp @@ -52,6 +52,17 @@ Y_UNIT_TEST_SUITE(TVolumeStatsTest) auto* msg = event->Get(); bytesCount = msg->DiskCounters->Simple.BytesCount.Value; + + UNIT_ASSERT_VALUES_EQUAL( + msg->DiskCounters->RequestCounters.ReadBlocks + .GetRequestBytes(), + msg->DiskCounters->Interconnect.TransportReadBlocks + .GetRequestBytes()); + UNIT_ASSERT_VALUES_EQUAL( + msg->DiskCounters->RequestCounters.WriteBlocks + .GetRequestBytes(), + msg->DiskCounters->Interconnect.TransportWriteBlocks + .GetRequestBytes()); } return TTestActorRuntime::DefaultObserverFunc(runtime, event);