aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service
diff options
context:
space:
mode:
authorSergey Polovko <sergey@polovko.me>2022-02-10 16:47:02 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:02 +0300
commit3e0b762a82514bac89c1dd6ea7211e381d8aa248 (patch)
treec2d1b379ecaf05ca8f11ed0b5da9d1a950e6e554 /library/cpp/monlib/service
parentab3783171cc30e262243a0227c86118f7080c896 (diff)
downloadydb-3e0b762a82514bac89c1dd6ea7211e381d8aa248.tar.gz
Restoring authorship annotation for Sergey Polovko <sergey@polovko.me>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/service')
-rw-r--r--library/cpp/monlib/service/auth/tvm/auth.cpp2
-rw-r--r--library/cpp/monlib/service/auth/tvm/auth.h2
-rw-r--r--library/cpp/monlib/service/format.h2
-rw-r--r--library/cpp/monlib/service/mon_service_http_request.cpp2
-rw-r--r--library/cpp/monlib/service/mon_service_http_request.h44
-rw-r--r--library/cpp/monlib/service/monservice.cpp26
-rw-r--r--library/cpp/monlib/service/monservice.h78
-rw-r--r--library/cpp/monlib/service/pages/diag_mon_page.h16
-rw-r--r--library/cpp/monlib/service/pages/html_mon_page.cpp8
-rw-r--r--library/cpp/monlib/service/pages/html_mon_page.h20
-rw-r--r--library/cpp/monlib/service/pages/index_mon_page.cpp24
-rw-r--r--library/cpp/monlib/service/pages/index_mon_page.h44
-rw-r--r--library/cpp/monlib/service/pages/mon_page.cpp50
-rw-r--r--library/cpp/monlib/service/pages/mon_page.h84
-rw-r--r--library/cpp/monlib/service/pages/pre_mon_page.h28
-rw-r--r--library/cpp/monlib/service/pages/registry_mon_page.cpp16
-rw-r--r--library/cpp/monlib/service/pages/registry_mon_page.h4
-rw-r--r--library/cpp/monlib/service/pages/resource_mon_page.cpp2
-rw-r--r--library/cpp/monlib/service/pages/resource_mon_page.h60
-rw-r--r--library/cpp/monlib/service/pages/tablesorter/css_mon_page.h16
-rw-r--r--library/cpp/monlib/service/pages/tablesorter/js_mon_page.h16
-rw-r--r--library/cpp/monlib/service/pages/tablesorter/ya.make2
-rw-r--r--library/cpp/monlib/service/pages/templates.cpp2
-rw-r--r--library/cpp/monlib/service/pages/templates.h160
-rw-r--r--library/cpp/monlib/service/pages/version_mon_page.h14
-rw-r--r--library/cpp/monlib/service/pages/ya.make44
-rw-r--r--library/cpp/monlib/service/service.cpp72
-rw-r--r--library/cpp/monlib/service/service.h66
-rw-r--r--library/cpp/monlib/service/ya.make28
29 files changed, 466 insertions, 466 deletions
diff --git a/library/cpp/monlib/service/auth/tvm/auth.cpp b/library/cpp/monlib/service/auth/tvm/auth.cpp
index e071c11ebc..22f126eaad 100644
--- a/library/cpp/monlib/service/auth/tvm/auth.cpp
+++ b/library/cpp/monlib/service/auth/tvm/auth.cpp
@@ -33,7 +33,7 @@ namespace {
return AllowedClients_.contains(clientId);
}
- TCheckedServiceTicket CheckServiceTicket(TStringBuf ticket) override {
+ TCheckedServiceTicket CheckServiceTicket(TStringBuf ticket) override {
return Tvm_->CheckServiceTicket(ticket);
}
diff --git a/library/cpp/monlib/service/auth/tvm/auth.h b/library/cpp/monlib/service/auth/tvm/auth.h
index 432beff9d6..e9b71ef2d8 100644
--- a/library/cpp/monlib/service/auth/tvm/auth.h
+++ b/library/cpp/monlib/service/auth/tvm/auth.h
@@ -8,7 +8,7 @@ namespace NMonitoring {
struct ITvmManager {
virtual ~ITvmManager() = default;
virtual bool IsAllowedClient(NTvmAuth::TTvmId clientId) = 0;
- virtual NTvmAuth::TCheckedServiceTicket CheckServiceTicket(TStringBuf ticket) = 0;
+ virtual NTvmAuth::TCheckedServiceTicket CheckServiceTicket(TStringBuf ticket) = 0;
};
THolder<ITvmManager> CreateDefaultTvmManager(
diff --git a/library/cpp/monlib/service/format.h b/library/cpp/monlib/service/format.h
index 0044b586b1..16b6c12c48 100644
--- a/library/cpp/monlib/service/format.h
+++ b/library/cpp/monlib/service/format.h
@@ -1,6 +1,6 @@
#pragma once
-#include <library/cpp/monlib/encode/format.h>
+#include <library/cpp/monlib/encode/format.h>
#include <util/string/ascii.h>
#include <util/generic/yexception.h>
diff --git a/library/cpp/monlib/service/mon_service_http_request.cpp b/library/cpp/monlib/service/mon_service_http_request.cpp
index 5d805631d9..a0164afaec 100644
--- a/library/cpp/monlib/service/mon_service_http_request.cpp
+++ b/library/cpp/monlib/service/mon_service_http_request.cpp
@@ -1,4 +1,4 @@
-#include "mon_service_http_request.h"
+#include "mon_service_http_request.h"
#include "monservice.h"
using namespace NMonitoring;
diff --git a/library/cpp/monlib/service/mon_service_http_request.h b/library/cpp/monlib/service/mon_service_http_request.h
index b4f2f8f0c5..80fce27675 100644
--- a/library/cpp/monlib/service/mon_service_http_request.h
+++ b/library/cpp/monlib/service/mon_service_http_request.h
@@ -1,12 +1,12 @@
#pragma once
-#include "service.h"
-
+#include "service.h"
+
#include <util/stream/output.h>
namespace NMonitoring {
- class TMonService2;
- class IMonPage;
+ class TMonService2;
+ class IMonPage;
// XXX: IHttpRequest is already taken
struct IMonHttpRequest {
@@ -34,26 +34,26 @@ namespace NMonitoring {
};
struct TMonService2HttpRequest: IMonHttpRequest {
- IOutputStream* const Out;
- const IHttpRequest* const HttpRequest;
- TMonService2* const MonService;
- IMonPage* const MonPage;
- const TString PathInfo;
- TMonService2HttpRequest* const Parent;
-
- TMonService2HttpRequest(
+ IOutputStream* const Out;
+ const IHttpRequest* const HttpRequest;
+ TMonService2* const MonService;
+ IMonPage* const MonPage;
+ const TString PathInfo;
+ TMonService2HttpRequest* const Parent;
+
+ TMonService2HttpRequest(
IOutputStream* out, const IHttpRequest* httpRequest,
TMonService2* monService, IMonPage* monPage,
const TString& pathInfo,
TMonService2HttpRequest* parent)
- : Out(out)
- , HttpRequest(httpRequest)
- , MonService(monService)
- , MonPage(monPage)
- , PathInfo(pathInfo)
- , Parent(parent)
- {
- }
+ : Out(out)
+ , HttpRequest(httpRequest)
+ , MonService(monService)
+ , MonPage(monPage)
+ , PathInfo(pathInfo)
+ , Parent(parent)
+ {
+ }
~TMonService2HttpRequest() override;
@@ -85,6 +85,6 @@ namespace NMonitoring {
}
TString GetServiceTitle() const override;
- };
+ };
-}
+}
diff --git a/library/cpp/monlib/service/monservice.cpp b/library/cpp/monlib/service/monservice.cpp
index d1b9cda1d2..5c8fd6aaea 100644
--- a/library/cpp/monlib/service/monservice.cpp
+++ b/library/cpp/monlib/service/monservice.cpp
@@ -1,21 +1,21 @@
#include "monservice.h"
-
+
#include <library/cpp/malloc/api/malloc.h>
#include <library/cpp/string_utils/base64/base64.h>
#include <library/cpp/svnversion/svnversion.h>
-
+
#include <util/generic/map.h>
#include <util/generic/ptr.h>
#include <util/system/hostname.h>
-
+
#include <google/protobuf/text_format.h>
using namespace NMonitoring;
TMonService2::TMonService2(ui16 port, const TString& host, ui32 threads, const TString& title, THolder<IAuthProvider> auth)
: TMonService2(HttpServerOptions(port, host, threads), title, std::move(auth))
-{
-}
+{
+}
TMonService2::TMonService2(const THttpServerOptions& options, const TString& title, THolder<IAuthProvider> auth)
: NMonitoring::TMtHttpServer(options, std::bind(&TMonService2::ServeRequest, this, std::placeholders::_1, std::placeholders::_2))
@@ -46,14 +46,14 @@ TMonService2::TMonService2(ui16 port, ui32 threads, const TString& title, THolde
TMonService2::TMonService2(ui16 port, const TString& title, THolder<IAuthProvider> auth)
: TMonService2(port, TString(), 0, title, std::move(auth))
-{
-}
+{
+}
-void TMonService2::OutputIndex(IOutputStream& out) {
+void TMonService2::OutputIndex(IOutputStream& out) {
IndexMonPage->OutputIndex(out, true);
}
-void TMonService2::OutputIndexPage(IOutputStream& out) {
+void TMonService2::OutputIndexPage(IOutputStream& out) {
out << HTTPOKHTML;
out << "<html>\n";
IndexMonPage->OutputHead(out);
@@ -61,7 +61,7 @@ void TMonService2::OutputIndexPage(IOutputStream& out) {
out << "</html>\n";
}
-void TMonService2::OutputIndexBody(IOutputStream& out) {
+void TMonService2::OutputIndexBody(IOutputStream& out) {
out << "<body>\n";
// part of common navbar
@@ -77,7 +77,7 @@ void TMonService2::OutputIndexBody(IOutputStream& out) {
<< "</body>\n";
}
-void TMonService2::ServeRequest(IOutputStream& out, const NMonitoring::IHttpRequest& request) {
+void TMonService2::ServeRequest(IOutputStream& out, const NMonitoring::IHttpRequest& request) {
TString path = request.GetPath();
Y_VERIFY(path.StartsWith('/'));
@@ -99,12 +99,12 @@ void TMonService2::ServeRequest(IOutputStream& out, const NMonitoring::IHttpRequ
OutputIndexPage(out);
} else {
TMonService2HttpRequest monService2HttpRequest(
- &out, &request, this, IndexMonPage.Get(), path, nullptr);
+ &out, &request, this, IndexMonPage.Get(), path, nullptr);
IndexMonPage->Output(monService2HttpRequest);
}
}
-void TMonService2::Register(IMonPage* page) {
+void TMonService2::Register(IMonPage* page) {
IndexMonPage->Register(page);
}
diff --git a/library/cpp/monlib/service/monservice.h b/library/cpp/monlib/service/monservice.h
index 8f5e52fcdb..492bd9bec7 100644
--- a/library/cpp/monlib/service/monservice.h
+++ b/library/cpp/monlib/service/monservice.h
@@ -1,73 +1,73 @@
#pragma once
-#include "service.h"
+#include "service.h"
#include "auth.h"
-#include "mon_service_http_request.h"
-
-#include <library/cpp/monlib/service/pages/index_mon_page.h>
-#include <library/cpp/monlib/service/pages/mon_page.h>
-
+#include "mon_service_http_request.h"
+
+#include <library/cpp/monlib/service/pages/index_mon_page.h>
+#include <library/cpp/monlib/service/pages/mon_page.h>
+
#include <util/system/progname.h>
-
+
#include <functional>
namespace NMonitoring {
- class TMonService2: public TMtHttpServer {
- protected:
- const TString Title;
- char StartTime[26];
- TIntrusivePtr<TIndexMonPage> IndexMonPage;
+ class TMonService2: public TMtHttpServer {
+ protected:
+ const TString Title;
+ char StartTime[26];
+ TIntrusivePtr<TIndexMonPage> IndexMonPage;
THolder<IAuthProvider> AuthProvider_;
- public:
+ public:
static THttpServerOptions HttpServerOptions(ui16 port, const TString& host, ui32 threads) {
- THttpServerOptions opts(port);
+ THttpServerOptions opts(port);
if (!host.empty()) {
opts.SetHost(host);
}
- opts.SetClientTimeout(TDuration::Minutes(1));
- opts.EnableCompression(true);
- opts.SetThreads(threads);
+ opts.SetClientTimeout(TDuration::Minutes(1));
+ opts.EnableCompression(true);
+ opts.SetThreads(threads);
opts.SetMaxConnections(std::max<ui32>(100, threads));
opts.EnableRejectExcessConnections(true);
- return opts;
- }
+ return opts;
+ }
static THttpServerOptions HttpServerOptions(ui16 port, ui32 threads) {
return HttpServerOptions(port, TString(), threads);
}
- public:
+ public:
explicit TMonService2(ui16 port, const TString& title = GetProgramName(), THolder<IAuthProvider> auth = nullptr);
explicit TMonService2(ui16 port, ui32 threads, const TString& title = GetProgramName(), THolder<IAuthProvider> auth = nullptr);
explicit TMonService2(ui16 port, const TString& host, ui32 threads, const TString& title = GetProgramName(), THolder<IAuthProvider> auth = nullptr);
explicit TMonService2(const THttpServerOptions& options, const TString& title = GetProgramName(), THolder<IAuthProvider> auth = nullptr);
explicit TMonService2(const THttpServerOptions& options, TSimpleSharedPtr<IThreadPool> pool, const TString& title = GetProgramName(), THolder<IAuthProvider> auth = nullptr);
- ~TMonService2() override {
- }
+ ~TMonService2() override {
+ }
- const char* GetStartTime() const {
- return StartTime;
- }
+ const char* GetStartTime() const {
+ return StartTime;
+ }
- const TString& GetTitle() const {
- return Title;
- }
+ const TString& GetTitle() const {
+ return Title;
+ }
- virtual void ServeRequest(IOutputStream& out, const NMonitoring::IHttpRequest& request);
- virtual void OutputIndex(IOutputStream& out);
- virtual void OutputIndexPage(IOutputStream& out);
- virtual void OutputIndexBody(IOutputStream& out);
+ virtual void ServeRequest(IOutputStream& out, const NMonitoring::IHttpRequest& request);
+ virtual void OutputIndex(IOutputStream& out);
+ virtual void OutputIndexPage(IOutputStream& out);
+ virtual void OutputIndexBody(IOutputStream& out);
- void Register(IMonPage* page);
+ void Register(IMonPage* page);
void Register(TMonPagePtr page);
- TIndexMonPage* RegisterIndexPage(const TString& path, const TString& title);
+ TIndexMonPage* RegisterIndexPage(const TString& path, const TString& title);
- IMonPage* FindPage(const TString& relativePath);
- TIndexMonPage* FindIndexPage(const TString& relativePath);
- void SortPages();
- };
+ IMonPage* FindPage(const TString& relativePath);
+ TIndexMonPage* FindIndexPage(const TString& relativePath);
+ void SortPages();
+ };
-}
+}
diff --git a/library/cpp/monlib/service/pages/diag_mon_page.h b/library/cpp/monlib/service/pages/diag_mon_page.h
index 761194d4ec..2d90d5850d 100644
--- a/library/cpp/monlib/service/pages/diag_mon_page.h
+++ b/library/cpp/monlib/service/pages/diag_mon_page.h
@@ -3,14 +3,14 @@
#include "pre_mon_page.h"
namespace NMonitoring {
- // internal diagnostics page
- struct TDiagMonPage: public TPreMonPage {
- TDiagMonPage()
- : TPreMonPage("diag", "Diagnostics Page")
- {
- }
+ // internal diagnostics page
+ struct TDiagMonPage: public TPreMonPage {
+ TDiagMonPage()
+ : TPreMonPage("diag", "Diagnostics Page")
+ {
+ }
void OutputText(IOutputStream& out, NMonitoring::IMonHttpRequest&) override;
- };
+ };
-}
+}
diff --git a/library/cpp/monlib/service/pages/html_mon_page.cpp b/library/cpp/monlib/service/pages/html_mon_page.cpp
index eb4eb3b66c..8c178e135f 100644
--- a/library/cpp/monlib/service/pages/html_mon_page.cpp
+++ b/library/cpp/monlib/service/pages/html_mon_page.cpp
@@ -1,6 +1,6 @@
#include "html_mon_page.h"
-#include <library/cpp/monlib/service/pages/templates.h>
+#include <library/cpp/monlib/service/pages/templates.h>
using namespace NMonitoring;
@@ -20,8 +20,8 @@ void THtmlMonPage::Output(NMonitoring::IMonHttpRequest& request) {
out << "<script language='javascript' type='text/javascript' src='https://yastatic.net/bootstrap/3.3.1/js/bootstrap.min.js'></script>\n";
if (OutputTableSorterJsCss) {
- out << "<link rel='stylesheet' href='/jquery.tablesorter.css'>\n";
- out << "<script language='javascript' type='text/javascript' src='/jquery.tablesorter.js'></script>\n";
+ out << "<link rel='stylesheet' href='/jquery.tablesorter.css'>\n";
+ out << "<script language='javascript' type='text/javascript' src='/jquery.tablesorter.js'></script>\n";
}
out << "<style type=\"text/css\">\n";
@@ -34,7 +34,7 @@ void THtmlMonPage::Output(NMonitoring::IMonHttpRequest& request) {
out << "</style>\n";
}
BODY() {
- OutputNavBar(out);
+ OutputNavBar(out);
DIV_CLASS("container") {
if (!!Title) {
diff --git a/library/cpp/monlib/service/pages/html_mon_page.h b/library/cpp/monlib/service/pages/html_mon_page.h
index e87c53b62b..305af355cb 100644
--- a/library/cpp/monlib/service/pages/html_mon_page.h
+++ b/library/cpp/monlib/service/pages/html_mon_page.h
@@ -3,14 +3,14 @@
#include "mon_page.h"
namespace NMonitoring {
- struct THtmlMonPage: public IMonPage {
- THtmlMonPage(const TString& path,
- const TString& title = TString(),
- bool outputTableSorterJsCss = false)
+ struct THtmlMonPage: public IMonPage {
+ THtmlMonPage(const TString& path,
+ const TString& title = TString(),
+ bool outputTableSorterJsCss = false)
: IMonPage(path, title)
- , OutputTableSorterJsCss(outputTableSorterJsCss)
- {
- }
+ , OutputTableSorterJsCss(outputTableSorterJsCss)
+ {
+ }
void Output(NMonitoring::IMonHttpRequest& request) override;
@@ -19,7 +19,7 @@ namespace NMonitoring {
virtual void OutputContent(NMonitoring::IMonHttpRequest& request) = 0;
- bool OutputTableSorterJsCss;
- };
+ bool OutputTableSorterJsCss;
+ };
-}
+}
diff --git a/library/cpp/monlib/service/pages/index_mon_page.cpp b/library/cpp/monlib/service/pages/index_mon_page.cpp
index 83ff8b529a..65f6c1ea59 100644
--- a/library/cpp/monlib/service/pages/index_mon_page.cpp
+++ b/library/cpp/monlib/service/pages/index_mon_page.cpp
@@ -1,7 +1,7 @@
-#include "index_mon_page.h"
-
+#include "index_mon_page.h"
+
#include <util/generic/cast.h>
-#include <util/string/ascii.h>
+#include <util/string/ascii.h>
using namespace NMonitoring;
@@ -51,7 +51,7 @@ void TIndexMonPage::Output(IMonHttpRequest& request) {
}
}
-void TIndexMonPage::OutputIndex(IOutputStream& out, bool pathEndsWithSlash) {
+void TIndexMonPage::OutputIndex(IOutputStream& out, bool pathEndsWithSlash) {
TGuard<TMutex> g(Mtx);
for (auto& Page : Pages) {
IMonPage* page = Page.Get();
@@ -65,7 +65,7 @@ void TIndexMonPage::OutputIndex(IOutputStream& out, bool pathEndsWithSlash) {
}
}
-void TIndexMonPage::Register(TMonPagePtr page) {
+void TIndexMonPage::Register(TMonPagePtr page) {
TGuard<TMutex> g(Mtx);
auto insres = PagesByPath.insert(std::make_pair("/" + page->GetPath(), page));
if (insres.second) {
@@ -80,10 +80,10 @@ void TIndexMonPage::Register(TMonPagePtr page) {
// this already present, replace it
insres.first->second = page;
}
- page->Parent = this;
+ page->Parent = this;
}
-TIndexMonPage* TIndexMonPage::RegisterIndexPage(const TString& path, const TString& title) {
+TIndexMonPage* TIndexMonPage::RegisterIndexPage(const TString& path, const TString& title) {
TGuard<TMutex> g(Mtx);
TIndexMonPage* page = VerifyDynamicCast<TIndexMonPage*>(FindPage(path));
if (page) {
@@ -116,7 +116,7 @@ void TIndexMonPage::OutputCommonJsCss(IOutputStream& out) {
out << "<script language='javascript' type='text/javascript' src='https://yastatic.net/bootstrap/3.3.1/js/bootstrap.min.js'></script>\n";
}
-void TIndexMonPage::OutputHead(IOutputStream& out) {
+void TIndexMonPage::OutputHead(IOutputStream& out) {
out << "<head>\n";
OutputCommonJsCss(out);
out << "<title>" << Title << "</title>\n";
@@ -128,19 +128,19 @@ void TIndexMonPage::OutputBody(IMonHttpRequest& req) {
out << "<body>\n";
// part of common navbar
- OutputNavBar(out);
+ OutputNavBar(out);
out << "<div class='container'>\n"
- << "<h2>" << Title << "</h2>\n";
+ << "<h2>" << Title << "</h2>\n";
OutputIndex(out, req.GetPathInfo().EndsWith('/'));
out << "<div>\n"
<< "</body>\n";
}
-void TIndexMonPage::SortPages() {
+void TIndexMonPage::SortPages() {
TGuard<TMutex> g(Mtx);
std::sort(Pages.begin(), Pages.end(), [](const TMonPagePtr& a, const TMonPagePtr& b) {
- return AsciiCompareIgnoreCase(a->GetTitle(), b->GetTitle()) < 0;
+ return AsciiCompareIgnoreCase(a->GetTitle(), b->GetTitle()) < 0;
});
}
diff --git a/library/cpp/monlib/service/pages/index_mon_page.h b/library/cpp/monlib/service/pages/index_mon_page.h
index bf514a3105..6831fd15ca 100644
--- a/library/cpp/monlib/service/pages/index_mon_page.h
+++ b/library/cpp/monlib/service/pages/index_mon_page.h
@@ -3,36 +3,36 @@
#include "mon_page.h"
namespace NMonitoring {
- struct TIndexMonPage: public IMonPage {
- TMutex Mtx;
- typedef TVector<TMonPagePtr> TPages;
- TPages Pages;
- typedef THashMap<TString, TMonPagePtr> TPagesByPath;
- TPagesByPath PagesByPath;
+ struct TIndexMonPage: public IMonPage {
+ TMutex Mtx;
+ typedef TVector<TMonPagePtr> TPages;
+ TPages Pages;
+ typedef THashMap<TString, TMonPagePtr> TPagesByPath;
+ TPagesByPath PagesByPath;
- TIndexMonPage(const TString& path, const TString& title)
- : IMonPage(path, title)
- {
- }
+ TIndexMonPage(const TString& path, const TString& title)
+ : IMonPage(path, title)
+ {
+ }
- ~TIndexMonPage() override {
- }
+ ~TIndexMonPage() override {
+ }
void Output(IMonHttpRequest& request) override;
void OutputIndexPage(IMonHttpRequest& request);
- virtual void OutputIndex(IOutputStream& out, bool pathEndsWithSlash);
- virtual void OutputCommonJsCss(IOutputStream& out);
- void OutputHead(IOutputStream& out);
+ virtual void OutputIndex(IOutputStream& out, bool pathEndsWithSlash);
+ virtual void OutputCommonJsCss(IOutputStream& out);
+ void OutputHead(IOutputStream& out);
void OutputBody(IMonHttpRequest& out);
- void Register(TMonPagePtr page);
- TIndexMonPage* RegisterIndexPage(const TString& path, const TString& title);
+ void Register(TMonPagePtr page);
+ TIndexMonPage* RegisterIndexPage(const TString& path, const TString& title);
- IMonPage* FindPage(const TString& relativePath);
- TIndexMonPage* FindIndexPage(const TString& relativePath);
+ IMonPage* FindPage(const TString& relativePath);
+ TIndexMonPage* FindIndexPage(const TString& relativePath);
- void SortPages();
+ void SortPages();
void ClearPages();
- };
+ };
-}
+}
diff --git a/library/cpp/monlib/service/pages/mon_page.cpp b/library/cpp/monlib/service/pages/mon_page.cpp
index 72033b1699..1bffd42027 100644
--- a/library/cpp/monlib/service/pages/mon_page.cpp
+++ b/library/cpp/monlib/service/pages/mon_page.cpp
@@ -9,28 +9,28 @@ IMonPage::IMonPage(const TString& path, const TString& title)
Y_VERIFY(!Path.StartsWith('/'));
Y_VERIFY(!Path.EndsWith('/'));
}
-
-void IMonPage::OutputNavBar(IOutputStream& out) {
- TVector<const IMonPage*> parents;
- for (const IMonPage* p = this; p; p = p->Parent) {
- parents.push_back(p);
- }
- std::reverse(parents.begin(), parents.end());
-
- out << "<ol class='breadcrumb'>\n";
-
- TString absolutePath;
- for (size_t i = 0; i < parents.size(); ++i) {
- const TString& title = parents[i]->GetTitle();
- if (i == parents.size() - 1) {
- out << "<li>" << title << "</li>\n";
- } else {
- if (!absolutePath.EndsWith('/')) {
- absolutePath += '/';
- }
- absolutePath += parents[i]->GetPath();
- out << "<li class='active'><a href='" << absolutePath << "'>" << title << "</a></li>\n";
- }
- }
- out << "</ol>\n";
-}
+
+void IMonPage::OutputNavBar(IOutputStream& out) {
+ TVector<const IMonPage*> parents;
+ for (const IMonPage* p = this; p; p = p->Parent) {
+ parents.push_back(p);
+ }
+ std::reverse(parents.begin(), parents.end());
+
+ out << "<ol class='breadcrumb'>\n";
+
+ TString absolutePath;
+ for (size_t i = 0; i < parents.size(); ++i) {
+ const TString& title = parents[i]->GetTitle();
+ if (i == parents.size() - 1) {
+ out << "<li>" << title << "</li>\n";
+ } else {
+ if (!absolutePath.EndsWith('/')) {
+ absolutePath += '/';
+ }
+ absolutePath += parents[i]->GetPath();
+ out << "<li class='active'><a href='" << absolutePath << "'>" << title << "</a></li>\n";
+ }
+ }
+ out << "</ol>\n";
+}
diff --git a/library/cpp/monlib/service/pages/mon_page.h b/library/cpp/monlib/service/pages/mon_page.h
index e396612bb0..da151e5255 100644
--- a/library/cpp/monlib/service/pages/mon_page.h
+++ b/library/cpp/monlib/service/pages/mon_page.h
@@ -1,66 +1,66 @@
#pragma once
-#include <library/cpp/monlib/service/service.h>
-#include <library/cpp/monlib/service/mon_service_http_request.h>
-
+#include <library/cpp/monlib/service/service.h>
+#include <library/cpp/monlib/service/mon_service_http_request.h>
+
#include <util/generic/string.h>
#include <util/generic/ptr.h>
namespace NMonitoring {
- static const char HTTPOKTEXT[] = "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nConnection: Close\r\n\r\n";
- static const char HTTPOKBIN[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/octet-stream\r\nConnection: Close\r\n\r\n";
- static const char HTTPOKHTML[] = "HTTP/1.1 200 Ok\r\nContent-Type: text/html\r\nConnection: Close\r\n\r\n";
- static const char HTTPOKJSON[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/json\r\nConnection: Close\r\n\r\n";
- static const char HTTPOKSPACK[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/x-solomon-spack\r\nConnection: Close\r\n\r\n";
+ static const char HTTPOKTEXT[] = "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nConnection: Close\r\n\r\n";
+ static const char HTTPOKBIN[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/octet-stream\r\nConnection: Close\r\n\r\n";
+ static const char HTTPOKHTML[] = "HTTP/1.1 200 Ok\r\nContent-Type: text/html\r\nConnection: Close\r\n\r\n";
+ static const char HTTPOKJSON[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/json\r\nConnection: Close\r\n\r\n";
+ static const char HTTPOKSPACK[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/x-solomon-spack\r\nConnection: Close\r\n\r\n";
static const char HTTPOKPROMETHEUS[] = "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nConnection: Close\r\n\r\n";
- static const char HTTPOKJAVASCRIPT[] = "HTTP/1.1 200 Ok\r\nContent-Type: text/javascript\r\nConnection: Close\r\n\r\n";
- static const char HTTPOKCSS[] = "HTTP/1.1 200 Ok\r\nContent-Type: text/css\r\nConnection: Close\r\n\r\n";
- static const char HTTPNOCONTENT[] = "HTTP/1.1 204 No content\r\nConnection: Close\r\n\r\n";
- static const char HTTPNOTFOUND[] = "HTTP/1.1 404 Invalid URI\r\nConnection: Close\r\n\r\nInvalid URL\r\n";
+ static const char HTTPOKJAVASCRIPT[] = "HTTP/1.1 200 Ok\r\nContent-Type: text/javascript\r\nConnection: Close\r\n\r\n";
+ static const char HTTPOKCSS[] = "HTTP/1.1 200 Ok\r\nContent-Type: text/css\r\nConnection: Close\r\n\r\n";
+ static const char HTTPNOCONTENT[] = "HTTP/1.1 204 No content\r\nConnection: Close\r\n\r\n";
+ static const char HTTPNOTFOUND[] = "HTTP/1.1 404 Invalid URI\r\nConnection: Close\r\n\r\nInvalid URL\r\n";
static const char HTTPUNAUTHORIZED[] = "HTTP/1.1 401 Unauthorized\r\nConnection: Close\r\n\r\nUnauthorized\r\n";
static const char HTTPFORBIDDEN[] = "HTTP/1.1 403 Forbidden\r\nConnection: Close\r\n\r\nForbidden\r\n";
- // Fonts
- static const char HTTPOKFONTEOT[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/vnd.ms-fontobject\r\nConnection: Close\r\n\r\n";
- static const char HTTPOKFONTTTF[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/x-font-ttf\r\nConnection: Close\r\n\r\n";
- static const char HTTPOKFONTWOFF[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/font-woff\r\nConnection: Close\r\n\r\n";
- static const char HTTPOKFONTWOFF2[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/font-woff2\r\nConnection: Close\r\n\r\n";
-
- // Images
- static const char HTTPOKPNG[] = "HTTP/1.1 200 Ok\r\nContent-Type: image/png\r\nConnection: Close\r\n\r\n";
- static const char HTTPOKSVG[] = "HTTP/1.1 200 Ok\r\nContent-Type: image/svg+xml\r\nConnection: Close\r\n\r\n";
+ // Fonts
+ static const char HTTPOKFONTEOT[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/vnd.ms-fontobject\r\nConnection: Close\r\n\r\n";
+ static const char HTTPOKFONTTTF[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/x-font-ttf\r\nConnection: Close\r\n\r\n";
+ static const char HTTPOKFONTWOFF[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/font-woff\r\nConnection: Close\r\n\r\n";
+ static const char HTTPOKFONTWOFF2[] = "HTTP/1.1 200 Ok\r\nContent-Type: application/font-woff2\r\nConnection: Close\r\n\r\n";
- class IMonPage;
+ // Images
+ static const char HTTPOKPNG[] = "HTTP/1.1 200 Ok\r\nContent-Type: image/png\r\nConnection: Close\r\n\r\n";
+ static const char HTTPOKSVG[] = "HTTP/1.1 200 Ok\r\nContent-Type: image/svg+xml\r\nConnection: Close\r\n\r\n";
- using TMonPagePtr = TIntrusivePtr<IMonPage>;
+ class IMonPage;
- class IMonPage: public TAtomicRefCount<IMonPage> {
- public:
- const TString Path;
- const TString Title;
- const IMonPage* Parent = nullptr;
+ using TMonPagePtr = TIntrusivePtr<IMonPage>;
- public:
- IMonPage(const TString& path, const TString& title = TString());
+ class IMonPage: public TAtomicRefCount<IMonPage> {
+ public:
+ const TString Path;
+ const TString Title;
+ const IMonPage* Parent = nullptr;
- virtual ~IMonPage() {
- }
+ public:
+ IMonPage(const TString& path, const TString& title = TString());
- void OutputNavBar(IOutputStream& out);
+ virtual ~IMonPage() {
+ }
- virtual const TString& GetPath() const {
- return Path;
- }
+ void OutputNavBar(IOutputStream& out);
+
+ virtual const TString& GetPath() const {
+ return Path;
+ }
- virtual const TString& GetTitle() const {
- return Title;
- }
+ virtual const TString& GetTitle() const {
+ return Title;
+ }
- bool IsInIndex() const {
+ bool IsInIndex() const {
return !Title.empty();
- }
+ }
virtual void Output(IMonHttpRequest& request) = 0;
- };
+ };
}
diff --git a/library/cpp/monlib/service/pages/pre_mon_page.h b/library/cpp/monlib/service/pages/pre_mon_page.h
index c9a923d39a..7f4199287d 100644
--- a/library/cpp/monlib/service/pages/pre_mon_page.h
+++ b/library/cpp/monlib/service/pages/pre_mon_page.h
@@ -3,25 +3,25 @@
#include "html_mon_page.h"
namespace NMonitoring {
- struct TPreMonPage: public THtmlMonPage {
- TPreMonPage(const TString& path,
- const TString& title = TString(),
- bool preTag = true,
- bool outputTableSorterJsCss = false)
- : THtmlMonPage(path, title, outputTableSorterJsCss)
- , PreTag(preTag)
- {
- }
+ struct TPreMonPage: public THtmlMonPage {
+ TPreMonPage(const TString& path,
+ const TString& title = TString(),
+ bool preTag = true,
+ bool outputTableSorterJsCss = false)
+ : THtmlMonPage(path, title, outputTableSorterJsCss)
+ , PreTag(preTag)
+ {
+ }
void OutputContent(NMonitoring::IMonHttpRequest& request) override;
- // hook to customize output
+ // hook to customize output
virtual void BeforePre(NMonitoring::IMonHttpRequest& request);
- // put your text here
+ // put your text here
virtual void OutputText(IOutputStream& out, NMonitoring::IMonHttpRequest&) = 0;
- const bool PreTag;
- };
+ const bool PreTag;
+ };
-}
+}
diff --git a/library/cpp/monlib/service/pages/registry_mon_page.cpp b/library/cpp/monlib/service/pages/registry_mon_page.cpp
index c59e50f622..e05c80d07f 100644
--- a/library/cpp/monlib/service/pages/registry_mon_page.cpp
+++ b/library/cpp/monlib/service/pages/registry_mon_page.cpp
@@ -1,18 +1,18 @@
#include "registry_mon_page.h"
-#include <library/cpp/monlib/encode/text/text.h>
-#include <library/cpp/monlib/encode/json/json.h>
+#include <library/cpp/monlib/encode/text/text.h>
+#include <library/cpp/monlib/encode/json/json.h>
#include <library/cpp/monlib/encode/prometheus/prometheus.h>
-#include <library/cpp/monlib/encode/spack/spack_v1.h>
+#include <library/cpp/monlib/encode/spack/spack_v1.h>
#include <library/cpp/monlib/service/format.h>
namespace NMonitoring {
- void TMetricRegistryPage::Output(NMonitoring::IMonHttpRequest& request) {
+ void TMetricRegistryPage::Output(NMonitoring::IMonHttpRequest& request) {
const auto formatStr = TStringBuf{request.GetPathInfo()}.RNextTok('/');
auto& out = request.Output();
if (!formatStr.empty()) {
- IMetricEncoderPtr encoder;
+ IMetricEncoderPtr encoder;
TString resp;
if (formatStr == TStringBuf("json")) {
@@ -26,7 +26,7 @@ namespace NMonitoring {
resp = HTTPOKPROMETHEUS;
encoder = NMonitoring::EncoderPrometheus(&out);
} else {
- ythrow yexception() << "unsupported metric encoding format: " << formatStr;
+ ythrow yexception() << "unsupported metric encoding format: " << formatStr;
}
out.Write(resp);
@@ -38,8 +38,8 @@ namespace NMonitoring {
}
}
- void TMetricRegistryPage::OutputText(IOutputStream& out, NMonitoring::IMonHttpRequest&) {
- IMetricEncoderPtr encoder = NMonitoring::EncoderText(&out);
+ void TMetricRegistryPage::OutputText(IOutputStream& out, NMonitoring::IMonHttpRequest&) {
+ IMetricEncoderPtr encoder = NMonitoring::EncoderText(&out);
RegistryRawPtr_->Accept(TInstant::Zero(), encoder.Get());
}
diff --git a/library/cpp/monlib/service/pages/registry_mon_page.h b/library/cpp/monlib/service/pages/registry_mon_page.h
index 2d26d3319c..c370dfc97b 100644
--- a/library/cpp/monlib/service/pages/registry_mon_page.h
+++ b/library/cpp/monlib/service/pages/registry_mon_page.h
@@ -2,11 +2,11 @@
#include "pre_mon_page.h"
-#include <library/cpp/monlib/metrics/metric_registry.h>
+#include <library/cpp/monlib/metrics/metric_registry.h>
namespace NMonitoring {
// For now this class can only enumerate all metrics without any grouping or serve JSON/Spack/Prometheus
- class TMetricRegistryPage: public TPreMonPage {
+ class TMetricRegistryPage: public TPreMonPage {
public:
TMetricRegistryPage(const TString& path, const TString& title, TAtomicSharedPtr<IMetricSupplier> registry)
: TPreMonPage(path, title)
diff --git a/library/cpp/monlib/service/pages/resource_mon_page.cpp b/library/cpp/monlib/service/pages/resource_mon_page.cpp
index ec4ac6a1a7..b8f7c73b25 100644
--- a/library/cpp/monlib/service/pages/resource_mon_page.cpp
+++ b/library/cpp/monlib/service/pages/resource_mon_page.cpp
@@ -4,7 +4,7 @@ using namespace NMonitoring;
void TResourceMonPage::Output(NMonitoring::IMonHttpRequest& request) {
IOutputStream& out = request.Output();
- switch (ResourceType) {
+ switch (ResourceType) {
case TEXT:
out << HTTPOKTEXT;
break;
diff --git a/library/cpp/monlib/service/pages/resource_mon_page.h b/library/cpp/monlib/service/pages/resource_mon_page.h
index f6ab67200e..43b1dfc9c4 100644
--- a/library/cpp/monlib/service/pages/resource_mon_page.h
+++ b/library/cpp/monlib/service/pages/resource_mon_page.h
@@ -5,39 +5,39 @@
#include <library/cpp/resource/resource.h>
namespace NMonitoring {
- struct TResourceMonPage: public IMonPage {
- public:
- enum EResourceType {
- BINARY,
- TEXT,
- JSON,
- CSS,
- JAVASCRIPT,
-
- FONT_EOT,
- FONT_TTF,
- FONT_WOFF,
- FONT_WOFF2,
-
- PNG,
- SVG
- };
-
- TResourceMonPage(const TString& path, const TString& resourceName,
- const EResourceType& resourceType = BINARY)
- : IMonPage(path, "")
- , ResourceName(resourceName)
- , ResourceType(resourceType)
- {
- }
+ struct TResourceMonPage: public IMonPage {
+ public:
+ enum EResourceType {
+ BINARY,
+ TEXT,
+ JSON,
+ CSS,
+ JAVASCRIPT,
+
+ FONT_EOT,
+ FONT_TTF,
+ FONT_WOFF,
+ FONT_WOFF2,
+
+ PNG,
+ SVG
+ };
+
+ TResourceMonPage(const TString& path, const TString& resourceName,
+ const EResourceType& resourceType = BINARY)
+ : IMonPage(path, "")
+ , ResourceName(resourceName)
+ , ResourceType(resourceType)
+ {
+ }
void Output(NMonitoring::IMonHttpRequest& request) override;
void NotFound(NMonitoring::IMonHttpRequest& request) const;
- private:
- TString ResourceName;
- EResourceType ResourceType;
- };
+ private:
+ TString ResourceName;
+ EResourceType ResourceType;
+ };
-}
+}
diff --git a/library/cpp/monlib/service/pages/tablesorter/css_mon_page.h b/library/cpp/monlib/service/pages/tablesorter/css_mon_page.h
index c2c8330089..abd1ed27b5 100644
--- a/library/cpp/monlib/service/pages/tablesorter/css_mon_page.h
+++ b/library/cpp/monlib/service/pages/tablesorter/css_mon_page.h
@@ -1,13 +1,13 @@
#pragma once
-#include <library/cpp/monlib/service/pages/resource_mon_page.h>
+#include <library/cpp/monlib/service/pages/resource_mon_page.h>
namespace NMonitoring {
- struct TTablesorterCssMonPage: public TResourceMonPage {
- TTablesorterCssMonPage()
- : TResourceMonPage("jquery.tablesorter.css", "jquery.tablesorter.css", CSS)
- {
- }
- };
+ struct TTablesorterCssMonPage: public TResourceMonPage {
+ TTablesorterCssMonPage()
+ : TResourceMonPage("jquery.tablesorter.css", "jquery.tablesorter.css", CSS)
+ {
+ }
+ };
-}
+}
diff --git a/library/cpp/monlib/service/pages/tablesorter/js_mon_page.h b/library/cpp/monlib/service/pages/tablesorter/js_mon_page.h
index f8a1d8254e..79a1a2f667 100644
--- a/library/cpp/monlib/service/pages/tablesorter/js_mon_page.h
+++ b/library/cpp/monlib/service/pages/tablesorter/js_mon_page.h
@@ -1,13 +1,13 @@
#pragma once
-#include <library/cpp/monlib/service/pages/resource_mon_page.h>
+#include <library/cpp/monlib/service/pages/resource_mon_page.h>
namespace NMonitoring {
- struct TTablesorterJsMonPage: public TResourceMonPage {
- TTablesorterJsMonPage()
- : TResourceMonPage("jquery.tablesorter.js", "jquery.tablesorter.js", JAVASCRIPT)
- {
- }
- };
+ struct TTablesorterJsMonPage: public TResourceMonPage {
+ TTablesorterJsMonPage()
+ : TResourceMonPage("jquery.tablesorter.js", "jquery.tablesorter.js", JAVASCRIPT)
+ {
+ }
+ };
-}
+}
diff --git a/library/cpp/monlib/service/pages/tablesorter/ya.make b/library/cpp/monlib/service/pages/tablesorter/ya.make
index b5b6a64da8..a07e43750a 100644
--- a/library/cpp/monlib/service/pages/tablesorter/ya.make
+++ b/library/cpp/monlib/service/pages/tablesorter/ya.make
@@ -8,7 +8,7 @@ RESOURCE(
)
PEERDIR(
- library/cpp/monlib/dynamic_counters
+ library/cpp/monlib/dynamic_counters
)
END()
diff --git a/library/cpp/monlib/service/pages/templates.cpp b/library/cpp/monlib/service/pages/templates.cpp
index ece12bea71..17442c8c9b 100644
--- a/library/cpp/monlib/service/pages/templates.cpp
+++ b/library/cpp/monlib/service/pages/templates.cpp
@@ -32,4 +32,4 @@ namespace NMonitoring {
extern const char DTermTag[] = "dt";
extern const char DDescTag[] = "dd";
-}
+}
diff --git a/library/cpp/monlib/service/pages/templates.h b/library/cpp/monlib/service/pages/templates.h
index b4656f059f..356cd13483 100644
--- a/library/cpp/monlib/service/pages/templates.h
+++ b/library/cpp/monlib/service/pages/templates.h
@@ -7,76 +7,76 @@
#define WITH_SCOPED_I(var, value, label) \
if (auto var = (value)) { \
- Y_UNUSED(var); \
- goto label; \
- } else \
- label \
- :
-
-#define TAG(name) WITH_SCOPED(tmp, NMonitoring::name(__stream))
-#define TAG_CLASS(name, cls) WITH_SCOPED(tmp, NMonitoring::name(__stream, cls))
-#define TAG_CLASS_STYLE(name, cls, style) WITH_SCOPED(tmp, NMonitoring::name(__stream, {{"class", cls}, {"style", style}}))
-#define TAG_CLASS_ID(name, cls, id) WITH_SCOPED(tmp, NMonitoring::name(__stream, cls, "", id))
-#define TAG_CLASS_FOR(name, cls, for0) WITH_SCOPED(tmp, NMonitoring::name(__stream, cls, for0))
-#define TAG_ATTRS(name, ...) WITH_SCOPED(tmp, NMonitoring::name(__stream, ##__VA_ARGS__))
-
-#define HTML(str) WITH_SCOPED(__stream, NMonitoring::TOutputStreamRef(str))
-
-#define HEAD() TAG(THead)
-#define BODY() TAG(TBody)
-#define HTML_TAG() TAG(THtml)
-#define DIV() TAG(TDiv)
-#define DIV_CLASS(cls) TAG_CLASS(TDiv, cls)
+ Y_UNUSED(var); \
+ goto label; \
+ } else \
+ label \
+ :
+
+#define TAG(name) WITH_SCOPED(tmp, NMonitoring::name(__stream))
+#define TAG_CLASS(name, cls) WITH_SCOPED(tmp, NMonitoring::name(__stream, cls))
+#define TAG_CLASS_STYLE(name, cls, style) WITH_SCOPED(tmp, NMonitoring::name(__stream, {{"class", cls}, {"style", style}}))
+#define TAG_CLASS_ID(name, cls, id) WITH_SCOPED(tmp, NMonitoring::name(__stream, cls, "", id))
+#define TAG_CLASS_FOR(name, cls, for0) WITH_SCOPED(tmp, NMonitoring::name(__stream, cls, for0))
+#define TAG_ATTRS(name, ...) WITH_SCOPED(tmp, NMonitoring::name(__stream, ##__VA_ARGS__))
+
+#define HTML(str) WITH_SCOPED(__stream, NMonitoring::TOutputStreamRef(str))
+
+#define HEAD() TAG(THead)
+#define BODY() TAG(TBody)
+#define HTML_TAG() TAG(THtml)
+#define DIV() TAG(TDiv)
+#define DIV_CLASS(cls) TAG_CLASS(TDiv, cls)
#define DIV_CLASS_ID(cls, id) TAG_CLASS_ID(TDiv, cls, id)
-#define PRE() TAG(TPre)
-#define TABLE() TAG(TTable)
-#define TABLE_CLASS(cls) TAG_CLASS(TTable, cls)
-#define TABLE_SORTABLE() TABLE_CLASS("table-sortable")
+#define PRE() TAG(TPre)
+#define TABLE() TAG(TTable)
+#define TABLE_CLASS(cls) TAG_CLASS(TTable, cls)
+#define TABLE_SORTABLE() TABLE_CLASS("table-sortable")
#define TABLE_SORTABLE_CLASS(cls) TABLE_CLASS(cls " table-sortable")
-#define TABLEHEAD() TAG(TTableHead)
-#define TABLEHEAD_CLASS(cls) TAG_CLASS(TTableHead, cls)
-#define TABLEBODY() TAG(TTableBody)
-#define TABLEBODY_CLASS(cls) TAG_CLASS(TTableBody, cls)
-#define TABLER() TAG(TTableR)
-#define TABLER_CLASS(cls) TAG_CLASS(TTableR, cls)
-#define TABLED() TAG(TTableD)
-#define TABLED_CLASS(cls) TAG_CLASS(TTableD, cls)
-#define TABLED_ATTRS(...) TAG_ATTRS(TTableD, ##__VA_ARGS__)
-#define TABLEH() TAG(TTableH)
-#define TABLEH_CLASS(cls) TAG_CLASS(TTableH, cls)
-#define FORM() TAG(TFormC)
-#define FORM_CLASS(cls) TAG_CLASS(TFormC, cls)
-#define LABEL() TAG(TLabelC)
-#define LABEL_CLASS(cls) TAG_CLASS(TLabelC, cls)
+#define TABLEHEAD() TAG(TTableHead)
+#define TABLEHEAD_CLASS(cls) TAG_CLASS(TTableHead, cls)
+#define TABLEBODY() TAG(TTableBody)
+#define TABLEBODY_CLASS(cls) TAG_CLASS(TTableBody, cls)
+#define TABLER() TAG(TTableR)
+#define TABLER_CLASS(cls) TAG_CLASS(TTableR, cls)
+#define TABLED() TAG(TTableD)
+#define TABLED_CLASS(cls) TAG_CLASS(TTableD, cls)
+#define TABLED_ATTRS(...) TAG_ATTRS(TTableD, ##__VA_ARGS__)
+#define TABLEH() TAG(TTableH)
+#define TABLEH_CLASS(cls) TAG_CLASS(TTableH, cls)
+#define FORM() TAG(TFormC)
+#define FORM_CLASS(cls) TAG_CLASS(TFormC, cls)
+#define LABEL() TAG(TLabelC)
+#define LABEL_CLASS(cls) TAG_CLASS(TLabelC, cls)
#define LABEL_CLASS_FOR(cls, for0) TAG_CLASS_FOR(TLabelC, cls, for0)
-#define SPAN_CLASS(cls) TAG_CLASS(TSpanC, cls)
+#define SPAN_CLASS(cls) TAG_CLASS(TSpanC, cls)
#define SPAN_CLASS_STYLE(cls, style) TAG_CLASS_STYLE(TSpanC, cls, style)
-#define PARA() TAG(TPara)
-#define PARA_CLASS(cls) TAG_CLASS(TPara, cls)
-
-#define H1() TAG(TH1)
-#define H1_CLASS(cls) TAG_CLASS(TH1, cls)
-#define H2() TAG(TH2)
-#define H2_CLASS(cls) TAG_CLASS(TH2, cls)
-#define H3() TAG(TH3)
-#define H3_CLASS(cls) TAG_CLASS(TH3, cls)
-#define H4() TAG(TH4)
-#define H4_CLASS(cls) TAG_CLASS(TH4, cls)
-#define H5() TAG(TH5)
-#define H5_CLASS(cls) TAG_CLASS(TH5, cls)
-#define H6() TAG(TH6)
-#define H6_CLASS(cls) TAG_CLASS(TH6, cls)
-
-#define SMALL() TAG(TSMALL)
-#define STRONG() TAG(TSTRONG)
-
-#define LI() TAG(TLIST)
-#define LI_CLASS(cls) TAG_CLASS(TLIST, cls)
-#define UL() TAG(TULIST)
-#define UL_CLASS(cls) TAG_CLASS(TULIST, cls)
-#define OL() TAG(TOLIST)
-#define OL_CLASS(cls) TAG_CLASS(TOLIST, cls)
+#define PARA() TAG(TPara)
+#define PARA_CLASS(cls) TAG_CLASS(TPara, cls)
+
+#define H1() TAG(TH1)
+#define H1_CLASS(cls) TAG_CLASS(TH1, cls)
+#define H2() TAG(TH2)
+#define H2_CLASS(cls) TAG_CLASS(TH2, cls)
+#define H3() TAG(TH3)
+#define H3_CLASS(cls) TAG_CLASS(TH3, cls)
+#define H4() TAG(TH4)
+#define H4_CLASS(cls) TAG_CLASS(TH4, cls)
+#define H5() TAG(TH5)
+#define H5_CLASS(cls) TAG_CLASS(TH5, cls)
+#define H6() TAG(TH6)
+#define H6_CLASS(cls) TAG_CLASS(TH6, cls)
+
+#define SMALL() TAG(TSMALL)
+#define STRONG() TAG(TSTRONG)
+
+#define LI() TAG(TLIST)
+#define LI_CLASS(cls) TAG_CLASS(TLIST, cls)
+#define UL() TAG(TULIST)
+#define UL_CLASS(cls) TAG_CLASS(TULIST, cls)
+#define OL() TAG(TOLIST)
+#define OL_CLASS(cls) TAG_CLASS(TOLIST, cls)
#define DL() TAG(DLIST)
#define DL_CLASS(cls) TAG_CLASS(DLIST, cls)
@@ -85,8 +85,8 @@
#define DD() TAG(DDESC)
#define DD_CLASS(cls) TAG_CLASS(DDESC, cls)
-#define CAPTION() TAG(TCaption)
-#define CAPTION_CLASS(cls) CAPTION_CLASS(TCaption, cls)
+#define CAPTION() TAG(TCaption)
+#define CAPTION_CLASS(cls) CAPTION_CLASS(TCaption, cls)
#define HTML_OUTPUT_PARAM(str, param) str << #param << ": " << param << "<br/>"
#define HTML_OUTPUT_TIME_PARAM(str, param) str << #param << ": " << ToStringLocalTimeUpToSeconds(param) << "<br/>"
@@ -116,9 +116,9 @@ namespace NMonitoring {
IOutputStream& Str;
};
- template <const char* tag>
+ template <const char* tag>
struct TTag {
- TTag(IOutputStream& str, TStringBuf cls = "", TStringBuf for0 = "", TStringBuf id = "")
+ TTag(IOutputStream& str, TStringBuf cls = "", TStringBuf for0 = "", TStringBuf id = "")
: Str(str)
{
Str << "<" << tag;
@@ -137,7 +137,7 @@ namespace NMonitoring {
Str << ">";
}
- TTag(IOutputStream& str, std::initializer_list<std::pair<TStringBuf, TStringBuf>> attributes)
+ TTag(IOutputStream& str, std::initializer_list<std::pair<TStringBuf, TStringBuf>> attributes)
: Str(str)
{
Str << "<" << tag;
@@ -152,20 +152,20 @@ namespace NMonitoring {
~TTag() {
try {
Str << "</" << tag << ">";
- } catch (...) {
- }
+ } catch (...) {
+ }
}
explicit inline operator bool() const noexcept {
return true; // just to work with WITH_SCOPED
}
- IOutputStream& Str;
+ IOutputStream& Str;
};
// a nice class for creating collapsable regions of html output
struct TCollapsedButton {
- TCollapsedButton(IOutputStream& str, const TString& targetId, const TString& buttonText)
+ TCollapsedButton(IOutputStream& str, const TString& targetId, const TString& buttonText)
: Str(str)
{
Str << "<button type='button' class='btn' data-toggle='collapse' data-target='#" << targetId << "'>"
@@ -176,22 +176,22 @@ namespace NMonitoring {
~TCollapsedButton() {
try {
Str << "</div>";
- } catch (...) {
- }
+ } catch (...) {
+ }
}
explicit inline operator bool() const noexcept {
return true; // just to work with WITH_SCOPED
}
- IOutputStream& Str;
+ IOutputStream& Str;
};
struct TOutputStreamRef {
TOutputStreamRef(IOutputStream& str)
: Str(str)
- {
- }
+ {
+ }
inline operator IOutputStream&() noexcept {
return Str;
@@ -265,4 +265,4 @@ namespace NMonitoring {
typedef TTag<DListTag> DLIST;
typedef TTag<DTermTag> DTERM;
typedef TTag<DDescTag> DDESC;
-}
+}
diff --git a/library/cpp/monlib/service/pages/version_mon_page.h b/library/cpp/monlib/service/pages/version_mon_page.h
index f7649947e4..1ccfc6698e 100644
--- a/library/cpp/monlib/service/pages/version_mon_page.h
+++ b/library/cpp/monlib/service/pages/version_mon_page.h
@@ -3,13 +3,13 @@
#include "pre_mon_page.h"
namespace NMonitoring {
- struct TVersionMonPage: public TPreMonPage {
- TVersionMonPage(const TString& path = "ver", const TString& title = "Version")
- : TPreMonPage(path, title)
- {
- }
+ struct TVersionMonPage: public TPreMonPage {
+ TVersionMonPage(const TString& path = "ver", const TString& title = "Version")
+ : TPreMonPage(path, title)
+ {
+ }
void OutputText(IOutputStream& out, NMonitoring::IMonHttpRequest&) override;
- };
+ };
-}
+}
diff --git a/library/cpp/monlib/service/pages/ya.make b/library/cpp/monlib/service/pages/ya.make
index 48d44a0838..b9b6ca5646 100644
--- a/library/cpp/monlib/service/pages/ya.make
+++ b/library/cpp/monlib/service/pages/ya.make
@@ -1,31 +1,31 @@
-LIBRARY()
-
+LIBRARY()
+
OWNER(g:solomon)
-
+
NO_WSHADOW()
-SRCS(
- diag_mon_page.cpp
- html_mon_page.cpp
- index_mon_page.cpp
- mon_page.cpp
- pre_mon_page.cpp
- resource_mon_page.cpp
- templates.cpp
- version_mon_page.cpp
+SRCS(
+ diag_mon_page.cpp
+ html_mon_page.cpp
+ index_mon_page.cpp
+ mon_page.cpp
+ pre_mon_page.cpp
+ resource_mon_page.cpp
+ templates.cpp
+ version_mon_page.cpp
registry_mon_page.cpp
-)
-
-PEERDIR(
+)
+
+PEERDIR(
library/cpp/build_info
library/cpp/malloc/api
library/cpp/svnversion
library/cpp/resource
- library/cpp/monlib/service
- library/cpp/monlib/encode/json
- library/cpp/monlib/encode/text
- library/cpp/monlib/encode/spack
+ library/cpp/monlib/service
+ library/cpp/monlib/encode/json
+ library/cpp/monlib/encode/text
+ library/cpp/monlib/encode/spack
library/cpp/monlib/encode/prometheus
-)
-
-END()
+)
+
+END()
diff --git a/library/cpp/monlib/service/service.cpp b/library/cpp/monlib/service/service.cpp
index 929efbf816..0db0e206d0 100644
--- a/library/cpp/monlib/service/service.cpp
+++ b/library/cpp/monlib/service/service.cpp
@@ -7,13 +7,13 @@
#include <library/cpp/uri/http_url.h>
#include <util/generic/buffer.h>
-#include <util/stream/str.h>
+#include <util/stream/str.h>
#include <util/stream/buffer.h>
-#include <util/stream/zerocopy.h>
-#include <util/string/vector.h>
-
+#include <util/stream/zerocopy.h>
+#include <util/string/vector.h>
+
namespace NMonitoring {
- class THttpClient: public IHttpRequest {
+ class THttpClient: public IHttpRequest {
public:
void ServeRequest(THttpInput& in, IOutputStream& out, const NAddr::IRemoteAddr* remoteAddr, const THandler& Handler) {
try {
@@ -36,7 +36,7 @@ namespace NMonitoring {
}
Headers = &in.Headers();
CgiParams.Scan(Url.Get(THttpURL::FieldQuery));
- } catch (...) {
+ } catch (...) {
out << "HTTP/1.1 500 Internal server error\r\nConnection: Close\r\n\r\n";
YSYSLOG(TLOG_ERR, "THttpClient: internal error while serving monitoring request: %s", CurrentExceptionMessage().data());
}
@@ -46,7 +46,7 @@ namespace NMonitoring {
Handler(out, *this);
out.Finish();
- } catch (...) {
+ } catch (...) {
auto msg = CurrentExceptionMessage();
out << "HTTP/1.1 500 Internal server error\r\nConnection: Close\r\n\r\n" << msg;
out.Finish();
@@ -102,7 +102,7 @@ namespace NMonitoring {
/* TCoHttpServer */
- class TCoHttpServer::TConnection: public THttpClient {
+ class TCoHttpServer::TConnection: public THttpClient {
public:
TConnection(const TCoHttpServer::TAcceptFull& acc, const TCoHttpServer& parent)
: Socket(acc.S->Release())
@@ -111,7 +111,7 @@ namespace NMonitoring {
{
}
- void operator()(TCont* c) {
+ void operator()(TCont* c) {
try {
THolder<TConnection> me(this);
TContIO io(Socket, c);
@@ -122,11 +122,11 @@ namespace NMonitoring {
ServeRequest(in, s, RemoteAddr, Parent.Handler);
out << s.Str();
out.Finish();
- } catch (...) {
+ } catch (...) {
YSYSLOG(TLOG_WARNING, "TCoHttpServer::TConnection: error: %s\n", CurrentExceptionMessage().data());
}
}
-
+
private:
TSocketHolder Socket;
const NAddr::IRemoteAddr* RemoteAddr;
@@ -171,15 +171,15 @@ namespace NMonitoring {
TSocket sock(addr);
TSocketOutput sock_out(sock);
TSocketInput sock_in(sock);
- sock_out << "GET " << request.GetURI() << " HTTP/1.0\r\n\r\n";
+ sock_out << "GET " << request.GetURI() << " HTTP/1.0\r\n\r\n";
THttpInput http_in(&sock_in);
try {
out << "HTTP/1.1 200 Ok\nConnection: Close\n\n";
TransferData(&http_in, &out);
- } catch (...) {
+ } catch (...) {
YSYSLOG(TLOG_DEBUG, "TCoHttpServer: while getting data from backend: %s", CurrentExceptionMessage().data());
}
- } catch (const yexception& /*e*/) {
+ } catch (const yexception& /*e*/) {
out << "HTTP/1.1 500 Internal server error\nConnection: Close\n\n";
YSYSLOG(TLOG_DEBUG, "TCoHttpServer: while getting data from backend: %s", CurrentExceptionMessage().data());
}
@@ -187,7 +187,7 @@ namespace NMonitoring {
/* TMtHttpServer */
- class TMtHttpServer::TConnection: public TClientRequest, public THttpClient {
+ class TMtHttpServer::TConnection: public TClientRequest, public THttpClient {
public:
TConnection(const TMtHttpServer& parent)
: Parent(parent)
@@ -198,7 +198,7 @@ namespace NMonitoring {
ServeRequest(Input(), Output(), NAddr::GetPeerAddr(Socket()).Get(), Parent.Handler);
return true;
}
-
+
private:
const TMtHttpServer& Parent;
};
@@ -215,32 +215,32 @@ namespace NMonitoring {
{
}
- bool TMtHttpServer::Start() {
- return THttpServer::Start();
- }
-
- void TMtHttpServer::StartOrThrow() {
- if (!Start()) {
- const auto& opts = THttpServer::Options();
- TNetworkAddress addr = opts.Host
+ bool TMtHttpServer::Start() {
+ return THttpServer::Start();
+ }
+
+ void TMtHttpServer::StartOrThrow() {
+ if (!Start()) {
+ const auto& opts = THttpServer::Options();
+ TNetworkAddress addr = opts.Host
? TNetworkAddress(opts.Host, opts.Port)
: TNetworkAddress(opts.Port);
- ythrow TSystemError(GetErrorCode()) << addr;
- }
- }
-
- void TMtHttpServer::Stop() {
- THttpServer::Stop();
- }
-
+ ythrow TSystemError(GetErrorCode()) << addr;
+ }
+ }
+
+ void TMtHttpServer::Stop() {
+ THttpServer::Stop();
+ }
+
TClientRequest* TMtHttpServer::CreateClient() {
return new TConnection(*this);
}
/* TService */
- TMonService::TMonService(TContExecutor& executor, TIpPort internalPort, TIpPort externalPort,
- THandler coHandler, THandler mtHandler)
+ TMonService::TMonService(TContExecutor& executor, TIpPort internalPort, TIpPort externalPort,
+ THandler coHandler, THandler mtHandler)
: CoServer(executor, "127.0.0.1", internalPort, std::move(coHandler))
, MtServer(THttpServerOptions(externalPort), std::bind(&TMonService::DispatchRequest, this, std::placeholders::_1, std::placeholders::_2))
, MtHandler(std::move(mtHandler))
@@ -261,8 +261,8 @@ namespace NMonitoring {
if (strcmp(request.GetPath(), "/") == 0) {
out << "HTTP/1.1 200 Ok\nConnection: Close\n\n";
MtHandler(out, request);
- } else
+ } else
CoServer.ProcessRequest(out, request);
}
-}
+}
diff --git a/library/cpp/monlib/service/service.h b/library/cpp/monlib/service/service.h
index 2f66dddaf8..1bff927199 100644
--- a/library/cpp/monlib/service/service.h
+++ b/library/cpp/monlib/service/service.h
@@ -9,14 +9,14 @@
#include <util/network/ip.h>
#include <library/cpp/cgiparam/cgiparam.h>
-#include <functional>
+#include <functional>
struct TMonitor;
namespace NMonitoring {
struct IHttpRequest {
- virtual ~IHttpRequest() {
- }
+ virtual ~IHttpRequest() {
+ }
virtual const char* GetURI() const = 0;
virtual const char* GetPath() const = 0;
virtual const TCgiParameters& GetParams() const = 0;
@@ -28,9 +28,9 @@ namespace NMonitoring {
};
// first param - output stream to write result to
// second param - URL of request
- typedef std::function<void(IOutputStream&, const IHttpRequest&)> THandler;
+ typedef std::function<void(IOutputStream&, const IHttpRequest&)> THandler;
- class TCoHttpServer: private TContListener::ICallBack {
+ class TCoHttpServer: private TContListener::ICallBack {
public:
// initialize and schedule coroutines for execution
TCoHttpServer(TContExecutor& executor, const TString& bindAddr, TIpPort port, THandler handler);
@@ -42,14 +42,14 @@ namespace NMonitoring {
// @note this call may be blocking; don't use inside coroutines
// @throws may throw in case of connection error, etc
void ProcessRequest(IOutputStream&, const IHttpRequest&);
-
+
private:
class TConnection;
// ICallBack implementation
void OnAcceptFull(const TAcceptFull& a) override;
void OnError() override;
-
+
private:
TContExecutor& Executor;
TContListener Listener;
@@ -58,30 +58,30 @@ namespace NMonitoring {
TIpPort Port;
};
- class TMtHttpServer: public THttpServer, private THttpServer::ICallBack {
+ class TMtHttpServer: public THttpServer, private THttpServer::ICallBack {
public:
TMtHttpServer(const TOptions& options, THandler handler, IThreadFactory* pool = nullptr);
TMtHttpServer(const TOptions& options, THandler handler, TSimpleSharedPtr<IThreadPool> pool);
-
- /**
- * This will cause the server start to accept incoming connections.
- *
- * @return true if the port binding was successfull,
- * false otherwise.
- */
- bool Start();
-
- /**
- * Same as Start() member-function, but will throw TSystemError if
- * there were some errors.
- */
- void StartOrThrow();
-
- /**
- * Stops the server from accepting new connections.
- */
- void Stop();
-
+
+ /**
+ * This will cause the server start to accept incoming connections.
+ *
+ * @return true if the port binding was successfull,
+ * false otherwise.
+ */
+ bool Start();
+
+ /**
+ * Same as Start() member-function, but will throw TSystemError if
+ * there were some errors.
+ */
+ void StartOrThrow();
+
+ /**
+ * Stops the server from accepting new connections.
+ */
+ void Stop();
+
private:
class TConnection;
TClientRequest* CreateClient() override;
@@ -95,18 +95,18 @@ namespace NMonitoring {
// will be served in a coroutine context
class TMonService {
public:
- TMonService(TContExecutor& executor, TIpPort internalPort, TIpPort externalPort,
- THandler coHandler, THandler mtHandler);
+ TMonService(TContExecutor& executor, TIpPort internalPort, TIpPort externalPort,
+ THandler coHandler, THandler mtHandler);
void Start();
void Stop();
-
+
protected:
void DispatchRequest(IOutputStream& out, const IHttpRequest&);
-
+
private:
TCoHttpServer CoServer;
TMtHttpServer MtServer;
THandler MtHandler;
};
-}
+}
diff --git a/library/cpp/monlib/service/ya.make b/library/cpp/monlib/service/ya.make
index ad088fc2c6..7240be8071 100644
--- a/library/cpp/monlib/service/ya.make
+++ b/library/cpp/monlib/service/ya.make
@@ -1,18 +1,18 @@
-LIBRARY()
-
+LIBRARY()
+
OWNER(g:solomon)
-
-SRCS(
- monservice.cpp
- mon_service_http_request.cpp
- service.cpp
+
+SRCS(
+ monservice.cpp
+ mon_service_http_request.cpp
+ service.cpp
format.cpp
auth.cpp
-)
-
-PEERDIR(
+)
+
+PEERDIR(
library/cpp/string_utils/base64
- contrib/libs/protobuf
+ contrib/libs/protobuf
library/cpp/coroutine/engine
library/cpp/coroutine/listener
library/cpp/http/fetch
@@ -23,6 +23,6 @@ PEERDIR(
library/cpp/svnversion
library/cpp/uri
library/cpp/cgiparam
-)
-
-END()
+)
+
+END()