Skip to content

Commit b9edd6b

Browse files
authored
Merge c7147bc into 671ffc8
2 parents 671ffc8 + c7147bc commit b9edd6b

File tree

2 files changed

+52
-3
lines changed

2 files changed

+52
-3
lines changed

ydb/core/base/blobstorage.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,37 @@ struct TEvBlobStorage {
980980
ui32 RestartCounter = 0;
981981
std::shared_ptr<TExecutionRelay> ExecutionRelay;
982982
std::optional<ui32> ForceGroupGeneration;
983+
984+
static TString GetRequestName(ui32 eventType) {
985+
switch (eventType) {
986+
case EvPut:
987+
return "Put";
988+
case EvGet:
989+
return "Get";
990+
case EvBlock:
991+
return "Block";
992+
case EvCollectGarbage:
993+
return "CollectGarbase";
994+
case EvDiscover:
995+
return "Discover";
996+
case EvPatch:
997+
return "Patch";
998+
case EvInplacePatch:
999+
return "InplacePatch";
1000+
case EvCheckIntegrity:
1001+
return "CheckIntegrity";
1002+
case EvRange:
1003+
return "Range";
1004+
case EvStatus:
1005+
return "Status";
1006+
case EvAssimilate:
1007+
return "Assimilate";
1008+
case EvGetBlock:
1009+
return "GetBlock";
1010+
default:
1011+
return "Unknown";
1012+
}
1013+
}
9831014
};
9841015

9851016
struct TEvResultCommon {

ydb/core/blobstorage/bridge/proxy/bridge_proxy.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ namespace NKikimr {
4444
THPTimer Timer;
4545
std::deque<std::tuple<TString, TDuration>> SubrequestTimings;
4646

47+
NWilson::TSpan Span;
48+
4749
struct TDiscoverState {
4850
TLogoBlobID Id;
4951
TString Buffer;
@@ -98,10 +100,11 @@ namespace NKikimr {
98100

99101
template<typename TEvRequest>
100102
TRequest(TActorId sender, ui64 cookie, std::unique_ptr<TEvRequest>&& request, TIntrusivePtr<TBlobStorageGroupInfo> info,
101-
TThis& self)
103+
TThis& self, ui32 requestType, NWilson::TTraceId&& traceId)
102104
: Sender(sender)
103105
, Cookie(cookie)
104106
, Info(std::move(info))
107+
, Span(TWilson::BlobStorage, std::forward<NWilson::TTraceId>(traceId), "BridgedRequest", NWilson::EFlags::AUTO_END)
105108
{
106109
Y_ABORT_UNLESS(Info);
107110
Y_ABORT_UNLESS(Info->Group);
@@ -136,6 +139,13 @@ namespace NKikimr {
136139
}
137140

138141
OriginalRequest = std::move(request);
142+
143+
if (Span) {
144+
Span.Attribute("GroupId", Info->GroupID.GetRawId());
145+
Span.Attribute("database", AppData()->TenantName);
146+
Span.Attribute("storagePool", Info->GetStoragePoolName());
147+
Span.Attribute("RequestType", TEvBlobStorage::TEvRequestCommon::GetRequestName(requestType));
148+
}
139149
}
140150

141151
template<typename TEvent, typename... TArgs>
@@ -659,7 +669,8 @@ namespace NKikimr {
659669

660670
std::unique_ptr<TEvent> evPtr(ev->Release().Release());
661671
const TEvent& originalRequest = *evPtr;
662-
auto request = std::make_shared<TRequest>(ev->Sender, ev->Cookie, std::move(evPtr), Info, *this);
672+
auto request = std::make_shared<TRequest>(ev->Sender, ev->Cookie, std::move(evPtr), Info, *this,
673+
ev->GetTypeRewrite(), std::move(ev->TraceId));
663674

664675
STLOG(PRI_DEBUG, BS_PROXY_BRIDGE, BPB00, "new request", (RequestId, request->RequestId),
665676
(GroupId, GroupId), (Request, originalRequest.ToString()));
@@ -702,7 +713,7 @@ namespace NKikimr {
702713
Y_DEBUG_ABORT_UNLESS(inserted1);
703714

704715
// send event
705-
SendToBSProxy(SelfId(), groupId, ev.release(), cookie);
716+
SendToBSProxy(SelfId(), groupId, ev.release(), cookie, request->Span.GetTraceId());
706717
++request->ResponsesPending;
707718
}
708719

@@ -822,6 +833,13 @@ namespace NKikimr {
822833
(Response, response->ToString()),
823834
(Passed, TDuration::Seconds(request->Timer.Passed())),
824835
(SubrequestTimings, makeSubrequestTimings()));
836+
837+
if (success) {
838+
request->Span.EndOk();
839+
} else if (request->Span) {
840+
request->Span.EndError(common->ErrorReason);
841+
}
842+
825843
Send(request->Sender, response.release(), 0, request->Cookie);
826844
request->Finished = true;
827845
}

0 commit comments

Comments
 (0)