22#include " dsproxy_mon.h"
33#include " root_cause.h"
44#include " dsproxy_put_impl.h"
5+ #include < ydb/core/blobstorage/dsproxy/dsproxy_request_reporting.h>
56#include < ydb/core/blobstorage/vdisk/common/vdisk_events.h>
67
78#include < ydb/core/blobstorage/lwtrace_probes/blobstorage_probes.h>
@@ -83,6 +84,8 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
8384
8485 TBlobStorageGroupInfo::TGroupVDisks ExpiredVDiskSet;
8586
87+ TDuration LongRequestThreshold;
88+
8689 void SanityCheck () {
8790 if (RequestsSent <= MaxSaneRequests) {
8891 return ;
@@ -277,11 +280,11 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
277280 GetTotalTimeMs (record.GetTimestamps ()) - GetVDiskTimeMs (record.GetTimestamps ()),
278281 NKikimrBlobStorage::EPutHandleClass_Name (PutImpl.GetPutHandleClass ()),
279282 NKikimrProto::EReplyStatus_Name (status));
280- // if (RootCauseTrack.IsOn) {
281- // RootCauseTrack.OnReply(cookie.GetCauseIdx (),
282- // GetTotalTimeMs(record.GetTimestamps()) - GetVDiskTimeMs(record.GetTimestamps()),
283- // GetVDiskTimeMs(record.GetTimestamps()));
284- // }
283+ if (RootCauseTrack.IsOn ) {
284+ RootCauseTrack.OnReply (record. GetCookie (),
285+ GetTotalTimeMs (record.GetTimestamps ()) - GetVDiskTimeMs (record.GetTimestamps ()),
286+ GetVDiskTimeMs (record.GetTimestamps ()));
287+ }
285288
286289 if (status == NKikimrProto::BLOCKED || status == NKikimrProto::DEADLINE) {
287290 TString error = TStringBuilder () << " Got VPutResult status# " << status << " from VDiskId# " << vdiskId;
@@ -359,14 +362,14 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
359362 }
360363
361364 // Handle put results
362- // bool isCauseRegistered = !RootCauseTrack.IsOn;
365+ bool isCauseRegistered = !RootCauseTrack.IsOn ;
363366 TPutImpl::TPutResultVec putResults;
364367 for (auto &item : record.GetItems ()) {
365- // if (!isCauseRegistered) {
366- // isCauseRegistered = RootCauseTrack.OnReply(cookie.GetCauseIdx (),
367- // GetTotalTimeMs(record.GetTimestamps()) - GetVDiskTimeMs(record.GetTimestamps()),
368- // GetVDiskTimeMs(record.GetTimestamps()));
369- // }
368+ if (!isCauseRegistered) {
369+ isCauseRegistered = RootCauseTrack.OnReply (record. GetCookie (),
370+ GetTotalTimeMs (record.GetTimestamps ()) - GetVDiskTimeMs (record.GetTimestamps ()),
371+ GetVDiskTimeMs (record.GetTimestamps ()));
372+ }
370373
371374 Y_ABORT_UNLESS (item.HasStatus ());
372375 Y_ABORT_UNLESS (item.HasBlobID ());
@@ -472,6 +475,16 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
472475 PutImpl.Blobs [blobIdx].Recipient , PutImpl.Blobs [blobIdx].Cookie , false );
473476 PutImpl.Blobs [blobIdx].Replied = true ;
474477 }
478+
479+ if (TActivationContext::Monotonic () - StartTime >= LongRequestThreshold) {
480+ bool allowToReport = AllowToReport (HandleClass);
481+ R_LOG_WARN_S (" DEBUG" , TActivationContext::Monotonic () - StartTime << " " << LongRequestThreshold << " " << allowToReport << " "
482+ << NKikimrBlobStorage::EPutHandleClass_Name (PutImpl.GetPutHandleClass ()));
483+ if (allowToReport) {
484+ R_LOG_WARN_S (" BPP71" , " TEvPut Request was being processed for more than " << LongRequestThreshold
485+ << " , serialized RootCause# " << RootCauseTrack.ToString ());
486+ }
487+ }
475488 }
476489
477490 TString BlobIdSequenceToString () const {
@@ -535,6 +548,7 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
535548 , AccelerationParams(params.AccelerationParams)
536549 , IncarnationRecords(Info->GetTotalVDisksNum ())
537550 , ExpiredVDiskSet(&Info->GetTopology ())
551+ , LongRequestThreshold(params.LongRequestThreshold)
538552 {
539553 if (params.Common .Event ->Orbit .HasShuttles ()) {
540554 RootCauseTrack.IsOn = true ;
@@ -560,6 +574,7 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
560574 , AccelerationParams(params.AccelerationParams)
561575 , IncarnationRecords(Info->GetTotalVDisksNum ())
562576 , ExpiredVDiskSet(&Info->GetTopology ())
577+ , LongRequestThreshold(params.LongRequestThreshold)
563578 {
564579 Y_DEBUG_ABORT_UNLESS (params.Events .size () <= MaxBatchedPutRequests);
565580 for (auto &ev : params.Events ) {
@@ -665,12 +680,10 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
665680 void UpdatePengingVDiskResponseCount (const TDeque<TPutImpl::TPutEvent>& putEvents) {
666681 for (auto & event : putEvents) {
667682 std::visit ([&](auto & event) {
668- // Y_ABORT_UNLESS(event->Record.HasCookie());
669- // TCookie cookie(event->Record.GetCookie());
670- // if (RootCauseTrack.IsOn) {
671- // cookie.SetCauseIdx(RootCauseTrack.RegisterCause());
672- // event->Record.SetCookie(cookie);
673- // }
683+ ui64 causeIdx = RootCauseTrack.RegisterCause ();
684+ if (event->Record .HasCookie () && RootCauseTrack.IsOn ) {
685+ event->Record .SetCookie (causeIdx);
686+ }
674687 const ui32 orderNumber = Info->GetOrderNumber (VDiskIDFromVDiskID (event->Record .GetVDiskID ()));
675688 Y_ABORT_UNLESS (orderNumber < WaitingVDiskResponseCount.size ());
676689 WaitingVDiskCount += !WaitingVDiskResponseCount[orderNumber]++;
0 commit comments