Skip to content

Commit

Permalink
cleanup api and add local pdisk restart handler (#4982)
Browse files Browse the repository at this point in the history
  • Loading branch information
adameat authored May 29, 2024
1 parent 8ec6905 commit bd36f9e
Show file tree
Hide file tree
Showing 35 changed files with 471 additions and 148 deletions.
1 change: 1 addition & 0 deletions ydb/core/mon/async_http_mon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ void TAsyncHttpMon::Start(TActorSystem* actorSystem) {
"text/javascript",
"application/javascript",
"application/json",
"application/yaml",
};
addPort->SslCertificatePem = Config.Certificate;
addPort->Secure = !Config.Certificate.empty();
Expand Down
8 changes: 4 additions & 4 deletions ydb/core/viewer/json_acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class TJsonACL : public TViewerPipeClient<TJsonACL> {

void ReplyAndPassAway() {
TStringStream json;
TString headers = Viewer->GetHTTPOKJSON(Event->Get());
if (DescribeResult != nullptr) {
//TProtoToJson::ProtoToJson(json, DescribeResult->GetRecord(), JsonSettings);
const auto& pbRecord(DescribeResult->GetRecord());
Expand Down Expand Up @@ -155,16 +154,17 @@ class TJsonACL : public TViewerPipeClient<TJsonACL> {

switch (DescribeResult->GetRecord().GetStatus()) {
case NKikimrScheme::StatusAccessDenied:
headers = Viewer->GetHTTPFORBIDDEN(Event->Get());
break;
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPFORBIDDEN(Event->Get()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
return;
default:
break;
}
} else {
json << "null";
}

Send(Event->Sender, new NMon::TEvHttpInfoRes(headers + json.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/viewer/json_autocomplete.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class TJsonAutocomplete : public TViewerPipeClient<TJsonAutocomplete> {
} else {
TStringStream json;
TProtoToJson::ProtoToJson(json, Result, JsonSettings);
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + json.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
}
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/viewer/json_browse.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class TJsonBrowse : public TActorBootstrapped<TJsonBrowse> {
}
TProtoToJson::ProtoToJson(json, browseInfo, JsonSettings);
}
ctx.Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + json.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
ctx.Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Die(ctx);
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/viewer/json_bscontrollerinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TJsonBSControllerInfo : public TViewerPipeClient<TJsonBSControllerInfo> {
} else {
json << "null";
}
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + json.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/viewer/json_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TJsonConfig : public TActorBootstrapped<TJsonConfig> {
config.MutableNameserviceConfig()->ClearAcceptUUID();
config.ClearAuthConfig();
TProtoToJson::ProtoToJson(json, config);
ctx.Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + json.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
ctx.Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Die(ctx);
}
};
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/viewer/json_counters.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ class TJsonCounters : public TActorBootstrapped<TJsonCounters> {
json << ']';
json << '}';

ctx.Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + json.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
ctx.Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Die(ctx);
}

Expand Down
7 changes: 4 additions & 3 deletions ydb/core/viewer/json_describe.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ class TJsonDescribe : public TViewerPipeClient<TJsonDescribe> {

void ReplyAndPassAway() {
TStringStream json;
TString headers = Viewer->GetHTTPOKJSON(Event->Get());
if (SchemeShardResult != nullptr && SchemeShardResult->GetRecord().GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
DescribeResult = GetSchemeShardDescribeSchemeInfo();
} else if (CacheResult != nullptr) {
Expand Down Expand Up @@ -264,15 +263,17 @@ class TJsonDescribe : public TViewerPipeClient<TJsonDescribe> {
const auto *descriptor = NKikimrScheme::EStatus_descriptor();
auto accessDeniedStatus = descriptor->FindValueByNumber(NKikimrScheme::StatusAccessDenied)->name();
if (DescribeResult->GetStatus() == accessDeniedStatus) {
headers = Viewer->GetHTTPFORBIDDEN(Event->Get());
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPFORBIDDEN(Event->Get()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
return;
}
TProtoToJson::ProtoToJson(json, *DescribeResult, JsonSettings);
DecodeExternalTableContent(json);
} else {
json << "null";
}

Send(Event->Sender, new NMon::TEvHttpInfoRes(headers + json.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
}

Expand Down
8 changes: 4 additions & 4 deletions ydb/core/viewer/json_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ class TJsonGraph : public TActorBootstrapped<TJsonGraph> {
if (response.GetError()) {
json["status"] = "error";
json["error"] = response.GetError();
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + NJson::WriteJson(json, false), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), NJson::WriteJson(json, false)), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
return PassAway();
}
if (response.DataSize() != Metrics.size()) {
json["status"] = "error";
json["error"] = "Invalid data size received";
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + NJson::WriteJson(json, false), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), NJson::WriteJson(json, false)), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
return PassAway();
}
for (size_t nMetric = 0; nMetric < response.DataSize(); ++nMetric) {
const auto& protoMetric(response.GetData(nMetric));
if (response.TimeSize() != protoMetric.ValuesSize()) {
json["status"] = "error";
json["error"] = "Invalid value size received";
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + NJson::WriteJson(json, false), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), NJson::WriteJson(json, false)), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
return PassAway();
}
}
Expand Down Expand Up @@ -133,7 +133,7 @@ class TJsonGraph : public TActorBootstrapped<TJsonGraph> {
}
}

Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + NJson::WriteJson(json, false), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), NJson::WriteJson(json, false)), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
}

Expand Down
14 changes: 10 additions & 4 deletions ydb/core/viewer/json_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class TJsonHandlerBase {
virtual TString GetRequestSummary() = 0;
virtual TString GetRequestDescription() = 0;
virtual YAML::Node GetRequestParameters() = 0;
virtual YAML::Node GetRequestSwagger() = 0;
};

template <typename ActorRequestType>
Expand Down Expand Up @@ -41,23 +42,28 @@ class TJsonHandler : public TJsonHandlerBase {
static YAML::Node parameters = TJsonRequestParameters<ActorRequestType>::GetParameters();
return parameters;
}

YAML::Node GetRequestSwagger() override {
static YAML::Node swagger = TJsonRequestSwagger<ActorRequestType>::GetSwagger();
return swagger;
}
};

struct TJsonHandlers {
std::vector<TString> JsonHandlersList;
THashMap<TString, TAutoPtr<TJsonHandlerBase>> JsonHandlersIndex;
THashMap<TString, std::shared_ptr<TJsonHandlerBase>> JsonHandlersIndex;

void AddHandler(const TString& name, TAutoPtr<TJsonHandlerBase> handler) {
void AddHandler(const TString& name, TJsonHandlerBase* handler) {
JsonHandlersList.push_back(name);
JsonHandlersIndex[name] = std::move(handler);
JsonHandlersIndex[name] = std::shared_ptr<TJsonHandlerBase>(handler);
}

TJsonHandlerBase* FindHandler(const TString& name) const {
auto it = JsonHandlersIndex.find(name);
if (it == JsonHandlersIndex.end()) {
return nullptr;
}
return it->second.Get();
return it->second.get();
}
};

Expand Down
15 changes: 15 additions & 0 deletions ydb/core/viewer/json_handlers_pdisk.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <ydb/core/blobstorage/vdisk/common/vdisk_events.h>
#include <ydb/core/blobstorage/base/blobstorage_events.h>

#include "json_handlers.h"

#include "json_pdisk_restart.h"


namespace NKikimr::NViewer {

void InitPDiskJsonHandlers(TJsonHandlers& jsonHandlers) {
jsonHandlers.AddHandler("/pdisk/restart", new TJsonHandler<TJsonPDiskRestart>);
}

}
6 changes: 3 additions & 3 deletions ydb/core/viewer/json_handlers_vdisk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
namespace NKikimr::NViewer {

void InitVDiskJsonHandlers(TJsonHandlers& jsonHandlers) {
jsonHandlers.AddHandler("/vdisk/json/vdiskstat", new TJsonHandler<TJsonVDiskStat>);
jsonHandlers.AddHandler("/vdisk/json/getblob", new TJsonHandler<TJsonGetBlob>);
jsonHandlers.AddHandler("/vdisk/json/blobindexstat", new TJsonHandler<TJsonBlobIndexStat>);
jsonHandlers.AddHandler("/vdisk/vdiskstat", new TJsonHandler<TJsonVDiskStat>);
jsonHandlers.AddHandler("/vdisk/getblob", new TJsonHandler<TJsonGetBlob>);
jsonHandlers.AddHandler("/vdisk/blobindexstat", new TJsonHandler<TJsonBlobIndexStat>);
}

}
76 changes: 38 additions & 38 deletions ydb/core/viewer/json_handlers_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,44 +43,44 @@
namespace NKikimr::NViewer {

void InitViewerJsonHandlers(TJsonHandlers& jsonHandlers) {
jsonHandlers.AddHandler("/viewer/json/nodelist", new TJsonHandler<TJsonNodeList>);
jsonHandlers.AddHandler("/viewer/json/nodeinfo", new TJsonHandler<TJsonNodeInfo>);
jsonHandlers.AddHandler("/viewer/json/sysinfo", new TJsonHandler<TJsonSysInfo>);
jsonHandlers.AddHandler("/viewer/json/vdiskinfo", new TJsonHandler<TJsonVDiskInfo>);
jsonHandlers.AddHandler("/viewer/json/pdiskinfo", new TJsonHandler<TJsonPDiskInfo>);
jsonHandlers.AddHandler("/viewer/json/tabletinfo", new TJsonHandler<TJsonTabletInfo>);
jsonHandlers.AddHandler("/viewer/json/describe", new TJsonHandler<TJsonDescribe>);
jsonHandlers.AddHandler("/viewer/json/describe_topic", new TJsonHandler<TJsonDescribeTopic>);
jsonHandlers.AddHandler("/viewer/json/describe_consumer", new TJsonHandler<TJsonDescribeConsumer>);
jsonHandlers.AddHandler("/viewer/json/hotkeys", new TJsonHandler<TJsonHotkeys>);
jsonHandlers.AddHandler("/viewer/json/hiveinfo", new TJsonHandler<TJsonHiveInfo>);
jsonHandlers.AddHandler("/viewer/json/bsgroupinfo", new TJsonHandler<TJsonBSGroupInfo>);
jsonHandlers.AddHandler("/viewer/json/bscontrollerinfo", new TJsonHandler<TJsonBSControllerInfo>);
jsonHandlers.AddHandler("/viewer/json/config", new TJsonHandler<TJsonConfig>);
jsonHandlers.AddHandler("/viewer/json/counters", new TJsonHandler<TJsonCounters>);
jsonHandlers.AddHandler("/viewer/json/topicinfo", new TJsonHandler<TJsonTopicInfo>);
jsonHandlers.AddHandler("/viewer/json/pqconsumerinfo", new TJsonHandler<TJsonPQConsumerInfo>);
jsonHandlers.AddHandler("/viewer/json/tabletcounters", new TJsonHandler<TJsonTabletCounters>);
jsonHandlers.AddHandler("/viewer/json/storage", new TJsonHandler<TJsonStorage>);
jsonHandlers.AddHandler("/viewer/json/storage_usage", new TJsonHandler<TJsonStorageUsage>);
jsonHandlers.AddHandler("/viewer/json/metainfo", new TJsonHandler<TJsonMetaInfo>);
jsonHandlers.AddHandler("/viewer/json/browse", new TJsonHandler<TJsonBrowse>);
jsonHandlers.AddHandler("/viewer/json/cluster", new TJsonHandler<TJsonCluster>);
jsonHandlers.AddHandler("/viewer/json/content", new TJsonHandler<TJsonContent>);
jsonHandlers.AddHandler("/viewer/json/labeledcounters", new TJsonHandler<TJsonLabeledCounters>);
jsonHandlers.AddHandler("/viewer/json/tenants", new TJsonHandler<TJsonTenants>);
jsonHandlers.AddHandler("/viewer/json/hivestats", new TJsonHandler<TJsonHiveStats>);
jsonHandlers.AddHandler("/viewer/json/tenantinfo", new TJsonHandler<TJsonTenantInfo>);
jsonHandlers.AddHandler("/viewer/json/whoami", new TJsonHandler<TJsonWhoAmI>);
jsonHandlers.AddHandler("/viewer/json/query", new TJsonHandler<TJsonQuery>);
jsonHandlers.AddHandler("/viewer/json/netinfo", new TJsonHandler<TJsonNetInfo>);
jsonHandlers.AddHandler("/viewer/json/compute", new TJsonHandler<TJsonCompute>);
jsonHandlers.AddHandler("/viewer/json/healthcheck", new TJsonHandler<TJsonHealthCheck>);
jsonHandlers.AddHandler("/viewer/json/nodes", new TJsonHandler<TJsonNodes>);
jsonHandlers.AddHandler("/viewer/json/acl", new TJsonHandler<TJsonACL>);
jsonHandlers.AddHandler("/viewer/json/graph", new TJsonHandler<TJsonGraph>);
jsonHandlers.AddHandler("/viewer/json/render", new TJsonHandler<TJsonRender>);
jsonHandlers.AddHandler("/viewer/json/autocomplete", new TJsonHandler<TJsonAutocomplete>);
jsonHandlers.AddHandler("/viewer/nodelist", new TJsonHandler<TJsonNodeList>);
jsonHandlers.AddHandler("/viewer/nodeinfo", new TJsonHandler<TJsonNodeInfo>);
jsonHandlers.AddHandler("/viewer/sysinfo", new TJsonHandler<TJsonSysInfo>);
jsonHandlers.AddHandler("/viewer/vdiskinfo", new TJsonHandler<TJsonVDiskInfo>);
jsonHandlers.AddHandler("/viewer/pdiskinfo", new TJsonHandler<TJsonPDiskInfo>);
jsonHandlers.AddHandler("/viewer/tabletinfo", new TJsonHandler<TJsonTabletInfo>);
jsonHandlers.AddHandler("/viewer/describe", new TJsonHandler<TJsonDescribe>);
jsonHandlers.AddHandler("/viewer/describe_topic", new TJsonHandler<TJsonDescribeTopic>);
jsonHandlers.AddHandler("/viewer/describe_consumer", new TJsonHandler<TJsonDescribeConsumer>);
jsonHandlers.AddHandler("/viewer/hotkeys", new TJsonHandler<TJsonHotkeys>);
jsonHandlers.AddHandler("/viewer/hiveinfo", new TJsonHandler<TJsonHiveInfo>);
jsonHandlers.AddHandler("/viewer/bsgroupinfo", new TJsonHandler<TJsonBSGroupInfo>);
jsonHandlers.AddHandler("/viewer/bscontrollerinfo", new TJsonHandler<TJsonBSControllerInfo>);
jsonHandlers.AddHandler("/viewer/config", new TJsonHandler<TJsonConfig>);
jsonHandlers.AddHandler("/viewer/counters", new TJsonHandler<TJsonCounters>);
jsonHandlers.AddHandler("/viewer/topicinfo", new TJsonHandler<TJsonTopicInfo>);
jsonHandlers.AddHandler("/viewer/pqconsumerinfo", new TJsonHandler<TJsonPQConsumerInfo>);
jsonHandlers.AddHandler("/viewer/tabletcounters", new TJsonHandler<TJsonTabletCounters>);
jsonHandlers.AddHandler("/viewer/storage", new TJsonHandler<TJsonStorage>);
jsonHandlers.AddHandler("/viewer/storage_usage", new TJsonHandler<TJsonStorageUsage>);
jsonHandlers.AddHandler("/viewer/metainfo", new TJsonHandler<TJsonMetaInfo>);
jsonHandlers.AddHandler("/viewer/browse", new TJsonHandler<TJsonBrowse>);
jsonHandlers.AddHandler("/viewer/cluster", new TJsonHandler<TJsonCluster>);
jsonHandlers.AddHandler("/viewer/content", new TJsonHandler<TJsonContent>);
jsonHandlers.AddHandler("/viewer/labeledcounters", new TJsonHandler<TJsonLabeledCounters>);
jsonHandlers.AddHandler("/viewer/tenants", new TJsonHandler<TJsonTenants>);
jsonHandlers.AddHandler("/viewer/hivestats", new TJsonHandler<TJsonHiveStats>);
jsonHandlers.AddHandler("/viewer/tenantinfo", new TJsonHandler<TJsonTenantInfo>);
jsonHandlers.AddHandler("/viewer/whoami", new TJsonHandler<TJsonWhoAmI>);
jsonHandlers.AddHandler("/viewer/query", new TJsonHandler<TJsonQuery>);
jsonHandlers.AddHandler("/viewer/netinfo", new TJsonHandler<TJsonNetInfo>);
jsonHandlers.AddHandler("/viewer/compute", new TJsonHandler<TJsonCompute>);
jsonHandlers.AddHandler("/viewer/healthcheck", new TJsonHandler<TJsonHealthCheck>);
jsonHandlers.AddHandler("/viewer/nodes", new TJsonHandler<TJsonNodes>);
jsonHandlers.AddHandler("/viewer/acl", new TJsonHandler<TJsonACL>);
jsonHandlers.AddHandler("/viewer/graph", new TJsonHandler<TJsonGraph>);
jsonHandlers.AddHandler("/viewer/render", new TJsonHandler<TJsonRender>);
jsonHandlers.AddHandler("/viewer/autocomplete", new TJsonHandler<TJsonAutocomplete>);
}

}
2 changes: 1 addition & 1 deletion ydb/core/viewer/json_healthcheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class TJsonHealthCheck : public TActorBootstrapped<TJsonHealthCheck> {
void HandleJSON(NHealthCheck::TEvSelfCheckResult::TPtr& ev, const TActorContext &ctx) {
TStringStream json;
TProtoToJson::ProtoToJson(json, ev->Get()->Result, JsonSettings);
ctx.Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + json.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
ctx.Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Die(ctx);
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/viewer/json_hiveinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class TJsonHiveInfo : public TViewerPipeClient<TJsonHiveInfo> {
} else {
json << "null";
}
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + json.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/viewer/json_hivestats.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class TJsonHiveStats : public TViewerPipeClient<TJsonHiveStats> {
} else {
json << "null";
}
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get()) + json.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
}

Expand Down
8 changes: 4 additions & 4 deletions ydb/core/viewer/json_hotkeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,20 @@ class TJsonHotkeys : public TViewerPipeClient<TJsonHotkeys> {
}

void ReplyAndPassAway() {
TString headers = Viewer->GetHTTPOKJSON(Event->Get());
if (DescribeResult != nullptr) {
switch (DescribeResult->GetRecord().GetStatus()) {
case NKikimrScheme::StatusAccessDenied:
headers = Viewer->GetHTTPFORBIDDEN(Event->Get());
break;
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPFORBIDDEN(Event->Get()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
return;
default:
break;
}
}
NJson::TJsonValue root = BuildResponse();
TString json = NJson::WriteJson(root, false);

Send(Event->Sender, new NMon::TEvHttpInfoRes(headers + json, 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKJSON(Event->Get(), json), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
}

Expand Down
Loading

0 comments on commit bd36f9e

Please sign in to comment.