Skip to content

Commit

Permalink
tune trace names (#9540)
Browse files Browse the repository at this point in the history
  • Loading branch information
adameat authored Sep 20, 2024
1 parent 873eaad commit c41289f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ydb/core/viewer/json_pipe_req.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ TViewerPipeClient::TViewerPipeClient(NWilson::TTraceId traceId) {
}
}

TViewerPipeClient::TViewerPipeClient(IViewer* viewer, NMon::TEvHttpInfo::TPtr& ev)
TViewerPipeClient::TViewerPipeClient(IViewer* viewer, NMon::TEvHttpInfo::TPtr& ev, const TString& handlerName)
: Viewer(viewer)
, Event(ev)
{
Expand All @@ -48,7 +48,7 @@ TViewerPipeClient::TViewerPipeClient(IViewer* viewer, NMon::TEvHttpInfo::TPtr& e
traceId = NWilson::TTraceId::NewTraceId(verbosity, ttl);
}
if (traceId) {
Span = {TComponentTracingLevels::THttp::TopLevel, std::move(traceId), "http", NWilson::EFlags::AUTO_END};
Span = {TComponentTracingLevels::THttp::TopLevel, std::move(traceId), handlerName ? "http " + handlerName : "http viewer", NWilson::EFlags::AUTO_END};
Span.Attribute("request_type", TString(Event->Get()->Request.GetUri().Before('?')));
}
}
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/viewer/json_pipe_req.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class TViewerPipeClient : public TActorBootstrapped<TViewerPipeClient> {
~TViewerPipeClient();
TViewerPipeClient();
TViewerPipeClient(NWilson::TTraceId traceId);
TViewerPipeClient(IViewer* viewer, NMon::TEvHttpInfo::TPtr& ev);
TViewerPipeClient(IViewer* viewer, NMon::TEvHttpInfo::TPtr& ev, const TString& handlerName = {});
TActorId ConnectTabletPipe(TTabletId tabletId);
void SendEvent(std::unique_ptr<IEventHandle> event);
void SendRequest(TActorId recipient, IEventBase* ev, ui32 flags = 0, ui64 cookie = 0, NWilson::TTraceId traceId = {});
Expand Down
6 changes: 5 additions & 1 deletion ydb/core/viewer/storage_groups.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ class TStorageGroups : public TViewerPipeClient {
}

TStorageGroups(IViewer* viewer, NMon::TEvHttpInfo::TPtr& ev)
: TBase(viewer, ev)
: TBase(viewer, ev, "/storage/groups")
{
const auto& params(Event->Get()->Request.GetParams());
Timeout = FromStringWithDefault<ui32>(params.Get("timeout"), 10000);
Expand Down Expand Up @@ -1351,6 +1351,7 @@ class TStorageGroups : public TViewerPipeClient {
}
}
if (AreBSControllerRequestsDone() && FieldsNeeded(FieldsWbDisks)) {
AddEvent("SendWhiteboardRequests");
for (TGroup* group : GroupView) {
for (TNodeId nodeId : group->VDiskNodeIds) {
SendWhiteboardDisksRequest(nodeId);
Expand Down Expand Up @@ -1881,6 +1882,7 @@ class TStorageGroups : public TViewerPipeClient {
}

void ReplyAndPassAway() override {
AddEvent("ReplyAndPassAway");
ApplyEverything();
NKikimrViewer::TStorageGroupsInfo json;
json.SetVersion(Viewer->GetCapabilityVersion("/storage/groups"));
Expand Down Expand Up @@ -1977,12 +1979,14 @@ class TStorageGroups : public TViewerPipeClient {
jsonGroupGroup.SetGroupCount(groupGroup.Groups.size());
}
}
AddEvent("RenderingResult");
TStringStream out;
Proto2Json(json, out, {
.EnumMode = TProto2JsonConfig::EnumValueMode::EnumName,
.StringifyNumbers = TProto2JsonConfig::EStringifyNumbersMode::StringifyInt64Always,
.WriteNanAsString = true,
});
AddEvent("ResultReady");
TBase::ReplyAndPassAway(GetHTTPOKJSON(out.Str()));
}

Expand Down
12 changes: 5 additions & 7 deletions ydb/core/viewer/viewer_nodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -600,13 +600,8 @@ class TJsonNodes : public TViewerPipeClient {
}

public:
TString GetLogPrefix() {
static TString prefix = "json/nodes ";
return prefix;
}

TJsonNodes(IViewer* viewer, NMon::TEvHttpInfo::TPtr& ev)
: TBase(viewer, ev)
: TBase(viewer, ev, "/viewer/nodes")
{
const auto& params(Event->Get()->Request.GetParams());
JsonSettings.EnumAsNumbers = !FromStringWithDefault<bool>(params.Get("enums"), true);
Expand Down Expand Up @@ -1600,7 +1595,7 @@ class TJsonNodes : public TViewerPipeClient {
void SendWhiteboardSystemAndTabletsBatch(TNodeBatch& batch) {
TNodeId nodeId = OffloadMerge ? batch.ChooseNodeId() : 0;
if (batch.HasStaticNodes && (FieldsNeeded(FieldsVDisks) || FieldsNeeded(FieldsPDisks))) {
nodeId = 0; // we need to ask for all nodes anyway
nodeId = 0; // we need to ask for all nodes anyway (for the compatibility with older versions)
}
if (nodeId) {
if (FieldsNeeded(FieldsSystemState) && SystemViewerResponse.count(nodeId) == 0) {
Expand Down Expand Up @@ -2221,12 +2216,15 @@ class TJsonNodes : public TViewerPipeClient {
jsonNodeGroup.SetNodeCount(nodeGroup.Nodes.size());
}
}
AddEvent("RenderingResult");
TStringStream out;
Proto2Json(json, out, {
.EnumMode = TProto2JsonConfig::EnumValueMode::EnumName,
.MapAsObject = true,
.StringifyNumbers = TProto2JsonConfig::EStringifyNumbersMode::StringifyInt64Always,
.WriteNanAsString = true,
});
AddEvent("ResultReady");
TBase::ReplyAndPassAway(GetHTTPOKJSON(out.Str()));
}

Expand Down

0 comments on commit c41289f

Please sign in to comment.