11#include " keyvalue_flat_impl.h"
22
3- #include < ydb/library/actors/core/actor_bootstrapped.h>
4- #include < ydb/public/lib/base/msgbus.h>
53#include < ydb/core/base/tablet_pipe.h>
64#include < ydb/core/base/hive.h>
75#include < ydb/core/util/log_priority_mute_checker.h>
6+ #include < ydb/library/actors/core/actor_bootstrapped.h>
7+ #include < ydb/library/actors/wilson/wilson_span.h>
8+ #include < ydb/library/wilson_ids/wilson.h>
9+ #include < ydb/public/lib/base/msgbus.h>
810
911namespace NKikimr {
1012namespace NKeyValue {
@@ -62,6 +64,8 @@ class TKeyValueStorageRequest : public TActorBootstrapped<TKeyValueStorageReques
6264 TStackVec<ui32, 16 > YellowMoveChannels;
6365 TStackVec<ui32, 16 > YellowStopChannels;
6466
67+ NWilson::TSpan Span;
68+
6569public:
6670 static constexpr NKikimrServices::TActivity::EType ActorActivityType () {
6771 return NKikimrServices::TActivity::KEYVALUE_ACTOR;
@@ -84,6 +88,7 @@ class TKeyValueStorageRequest : public TActorBootstrapped<TKeyValueStorageReques
8488 , TabletGeneration(tabletGeneration)
8589 , IntermediateResults(std::move(intermediate))
8690 , TabletInfo(const_cast <TTabletStorageInfo*>(tabletInfo))
91+ , Span(TWilsonTablet::Tablet, IntermediateResults->Span.GetTraceId(), "KeyValue.StorageRequest")
8792 {
8893 IntermediateResults->Stat .KeyvalueStorageRequestSentAt = TAppData::TimeProvider->Now ();
8994 }
@@ -377,6 +382,7 @@ class TKeyValueStorageRequest : public TActorBootstrapped<TKeyValueStorageReques
377382 YellowMoveChannels.begin (), YellowMoveChannels.end ());
378383 TActorId keyValueActorId = IntermediateResults->KeyValueActorId ;
379384 ctx.Send (keyValueActorId, new TEvKeyValue::TEvIntermediate (std::move (IntermediateResults)));
385+ Span.EndOk ();
380386 Die (ctx);
381387 return true ;
382388 }
@@ -482,7 +488,9 @@ class TKeyValueStorageRequest : public TActorBootstrapped<TKeyValueStorageReques
482488 ctx.Send (keyValueActorId, new TEvKeyValue::TEvNotify (
483489 IntermediateResults->RequestUid ,
484490 IntermediateResults->CreatedAtGeneration , IntermediateResults->CreatedAtStep ,
485- IntermediateResults->Stat , status, std::move (IntermediateResults->RefCountsIncr )));
491+ IntermediateResults->Stat , status, std::move (IntermediateResults->RefCountsIncr )), 0 , 0 , Span.GetTraceId ());
492+
493+ Span.EndError (TStringBuilder () << status << " : " << errorDescription);
486494 Die (ctx);
487495 }
488496
@@ -588,7 +596,7 @@ class TKeyValueStorageRequest : public TActorBootstrapped<TKeyValueStorageReques
588596
589597 auto ev = std::make_unique<TEvBlobStorage::TEvGet>(readQueries, readQueryCount, IntermediateResults->Deadline , handleClass, false );
590598 ev->ReaderTabletData = {TabletInfo->TabletID , TabletGeneration};
591- SendToBSProxy (ctx, prevGroup, ev.release (), cookie);
599+ SendToBSProxy (ctx, prevGroup, ev.release (), cookie, Span. GetTraceId () );
592600 return true ;
593601 }
594602
@@ -599,7 +607,7 @@ class TKeyValueStorageRequest : public TActorBootstrapped<TKeyValueStorageReques
599607 Y_ABORT_UNLESS (getStatus.Status == NKikimrProto::UNKNOWN);
600608 SendToBSProxy (
601609 ctx, getStatus.GroupId ,
602- new TEvBlobStorage::TEvStatus (IntermediateResults->Deadline ), i);
610+ new TEvBlobStorage::TEvStatus (IntermediateResults->Deadline ), i, Span. GetTraceId () );
603611 ++GetStatusRequestsSent;
604612 }
605613 }
@@ -616,7 +624,7 @@ class TKeyValueStorageRequest : public TActorBootstrapped<TKeyValueStorageReques
616624 TLogoBlobID from (tabletId, 0 , 0 , channel, 0 , 0 );
617625 TLogoBlobID to (tabletId, Max<ui32>(), Max<ui32>(), channel, TLogoBlobID::MaxBlobSize, TLogoBlobID::MaxCookie);
618626 auto request = MakeHolder<TEvBlobStorage::TEvRange>(tabletId, from, to, false , TInstant::Max (), true );
619- SendToBSProxy (ctx, groupId, request.Release ());
627+ SendToBSProxy (ctx, groupId, request.Release (), 0 , Span. GetTraceId () );
620628 ++RangeRequestsSent;
621629 }
622630 }
@@ -647,7 +655,7 @@ class TKeyValueStorageRequest : public TActorBootstrapped<TKeyValueStorageReques
647655 << " Send TEvPut# " << put->ToString () << " to groupId# " << groupId
648656 << " now# " << TAppData::TimeProvider->Now ().MilliSeconds () << " Marker# KV60" );
649657
650- SendPutToGroup (ctx, groupId, TabletInfo.Get (), std::move (put), i);
658+ SendPutToGroup (ctx, groupId, TabletInfo.Get (), std::move (put), i, Span. GetTraceId () );
651659
652660 ++WriteRequestsSent;
653661 }
0 commit comments