Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ydb/core/viewer/counters_hosts.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class TCountersHostsList : public TActorBootstrapped<TCountersHostsList> {
}
}
}
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKTEXT(Event->Get()) + text.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Send(Event->Sender, new NMon::TEvHttpInfoRes(Viewer->GetHTTPOKTEXT(Event->Get(), text.Str()), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
PassAway();
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/viewer/json_handlers_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void InitViewerWhoAmIJsonHandler(TJsonHandlers& handlers) {
}

void InitViewerQueryJsonHandler(TJsonHandlers& handlers) {
handlers.AddHandler("/viewer/query", new TJsonHandler<TJsonQuery>(TJsonQuery::GetSwagger()), 4);
handlers.AddHandler("/viewer/query", new TJsonHandler<TJsonQuery>(TJsonQuery::GetSwagger()), 5);
}

void InitViewerNetInfoJsonHandler(TJsonHandlers& handlers) {
Expand Down
10 changes: 7 additions & 3 deletions ydb/core/viewer/json_local_rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,13 @@ class TJsonLocalRpc : public TViewerPipeClient {
auto result = MakeHolder<TEvLocalRpcPrivate::TEvGrpcRequestResult<TProtoResult>>();
if constexpr (TRpcEv::IsOp) {
if (response.operation().ready() && response.operation().status() == Ydb::StatusIds::SUCCESS) {
TProtoResult rs;
response.operation().result().UnpackTo(&rs);
result->Message = std::move(rs);
if (response.operation().has_result()) {
TProtoResult rs;
response.operation().result().UnpackTo(&rs);
result->Message = std::move(rs);
} else if constexpr (std::is_same_v<TProtoResult, Ydb::Operations::Operation>) {
result->Message = std::move(response.operation());
}
}
NYql::TIssues issues;
NYql::IssuesFromMessage(response.operation().issues(), issues);
Expand Down
32 changes: 24 additions & 8 deletions ydb/core/viewer/json_pipe_req.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "json_pipe_req.h"
#include "log.h"
#include <library/cpp/json/json_reader.h>
#include <library/cpp/json/json_writer.h>

Expand Down Expand Up @@ -573,6 +574,9 @@ TViewerPipeClient::TRequestResponse<TEvTxProxySchemeCache::TEvNavigateKeySetResu
void TViewerPipeClient::RequestTxProxyDescribe(const TString& path) {
THolder<TEvTxUserProxy::TEvNavigate> request(new TEvTxUserProxy::TEvNavigate());
request->Record.MutableDescribePath()->SetPath(path);
if (!Event->Get()->UserToken.empty()) {
request->Record.SetUserToken(Event->Get()->UserToken);
}
SendRequest(MakeTxProxyID(), request.Release());
}

Expand Down Expand Up @@ -739,6 +743,13 @@ void TViewerPipeClient::RequestDone(ui32 requests) {
if (requests == 0) {
return;
}
if (requests > Requests) {
BLOG_ERROR("Requests count mismatch: " << requests << " > " << Requests);
if (Span) {
Span.Event("Requests count mismatch");
}
requests = Requests;
}
Requests -= requests;
if (!DelayedRequests.empty()) {
SendDelayedRequests();
Expand All @@ -763,13 +774,15 @@ void TViewerPipeClient::HandleResolveResource(TEvTxProxySchemeCache::TEvNavigate
SharedDatabase = CanonizePath(entry.Path);
if (SharedDatabase == AppData()->TenantName) {
Direct = true;
return Bootstrap(); // retry bootstrap without redirect this time
Bootstrap(); // retry bootstrap without redirect this time
} else {
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(SharedDatabase);
}
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(SharedDatabase);
} else {
ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - shared database not found"));
return ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - shared database not found"));
}
}
RequestDone();
}

void TViewerPipeClient::HandleResolveDatabase(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr& ev) {
Expand All @@ -780,24 +793,27 @@ void TViewerPipeClient::HandleResolveDatabase(TEvTxProxySchemeCache::TEvNavigate
if (entry.DomainInfo && entry.DomainInfo->ResourcesDomainKey && entry.DomainInfo->DomainKey != entry.DomainInfo->ResourcesDomainKey) {
ResourceNavigateResponse = MakeRequestSchemeCacheNavigate(TPathId(entry.DomainInfo->ResourcesDomainKey));
Become(&TViewerPipeClient::StateResolveResource);
return;
} else {
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(CanonizePath(entry.Path));
}
DatabaseBoardInfoResponse = MakeRequestStateStorageEndpointsLookup(CanonizePath(entry.Path));
} else {
ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - not found"));
return ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - not found"));
}
}
RequestDone();
}

void TViewerPipeClient::HandleResolve(TEvStateStorage::TEvBoardInfo::TPtr& ev) {
if (DatabaseBoardInfoResponse) {
DatabaseBoardInfoResponse->Set(std::move(ev));
if (DatabaseBoardInfoResponse->IsOk()) {
ReplyAndPassAway(MakeForward(GetNodesFromBoardReply(DatabaseBoardInfoResponse->GetRef())));
return ReplyAndPassAway(MakeForward(GetNodesFromBoardReply(DatabaseBoardInfoResponse->GetRef())));
} else {
ReplyAndPassAway(GetHTTPBADREQUEST("text/plain", "Failed to resolve database - no nodes found"));
Direct = true;
Bootstrap(); // retry bootstrap without redirect this time
}
}
RequestDone();
}

void TViewerPipeClient::HandleTimeout() {
Expand Down
12 changes: 8 additions & 4 deletions ydb/core/viewer/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,15 @@ class TViewer : public TActorBootstrapped<TViewer>, public IViewer {
response << "HTTP/1.1 200 Ok\r\n";
response << "Content-Type: " << type << "\r\n";
response << "Content-Length: " << blob.size() << "\r\n";
response << "Date: " << TInstant::Now().ToRfc822String() << "\r\n";
if (lastModified) {
response << "Last-Modified: " << lastModified << "\r\n";
if (name == "/monitoring/index.html") {
response << "Cache-Control: no-store,max-age=0\r\n"; // do not cache
} else {
response << "Date: " << TInstant::Now().ToRfc822String() << "\r\n";
if (lastModified) {
response << "Last-Modified: " << lastModified << "\r\n";
}
response << "Cache-Control: max-age=604800\r\n"; // one week
}
response << "Cache-Control: max-age=604800\r\n"; // one week
response << "\r\n";
response.Write(blob.data(), blob.size());
Send(ev->Sender, new NMon::TEvHttpInfoRes(response.Str(), 0, NMon::IEvHttpInfoRes::EContentType::Custom));
Expand Down
Loading
Loading