aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service/monservice.cpp
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commitc2a1af049e9deca890e9923abe64fe6c59060348 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/monlib/service/monservice.cpp
parent1f553f46fb4f3c5eec631352cdd900a0709016af (diff)
downloadydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/service/monservice.cpp')
-rw-r--r--library/cpp/monlib/service/monservice.cpp110
1 files changed, 55 insertions, 55 deletions
diff --git a/library/cpp/monlib/service/monservice.cpp b/library/cpp/monlib/service/monservice.cpp
index 49a1c941e4..d1b9cda1d2 100644
--- a/library/cpp/monlib/service/monservice.cpp
+++ b/library/cpp/monlib/service/monservice.cpp
@@ -1,17 +1,17 @@
-#include "monservice.h"
+#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/map.h>
#include <util/generic/ptr.h>
-#include <util/system/hostname.h>
+#include <util/system/hostname.h>
#include <google/protobuf/text_format.h>
-
-using namespace NMonitoring;
-
+
+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))
{
@@ -19,15 +19,15 @@ TMonService2::TMonService2(ui16 port, const TString& host, ui32 threads, const T
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))
- , Title(title)
- , IndexMonPage(new TIndexMonPage("", Title))
+ , Title(title)
+ , IndexMonPage(new TIndexMonPage("", Title))
, AuthProvider_{std::move(auth)}
-{
+{
Y_VERIFY(!!title);
time_t t = time(nullptr);
- ctime_r(&t, StartTime);
-}
-
+ ctime_r(&t, StartTime);
+}
+
TMonService2::TMonService2(const THttpServerOptions& options, TSimpleSharedPtr<IThreadPool> pool, const TString& title, THolder<IAuthProvider> auth)
: NMonitoring::TMtHttpServer(options, std::bind(&TMonService2::ServeRequest, this, std::placeholders::_1, std::placeholders::_2), std::move(pool))
, Title(title)
@@ -50,33 +50,33 @@ TMonService2::TMonService2(ui16 port, const TString& title, THolder<IAuthProvide
}
void TMonService2::OutputIndex(IOutputStream& out) {
- IndexMonPage->OutputIndex(out, true);
-}
-
+ IndexMonPage->OutputIndex(out, true);
+}
+
void TMonService2::OutputIndexPage(IOutputStream& out) {
- out << HTTPOKHTML;
- out << "<html>\n";
- IndexMonPage->OutputHead(out);
- OutputIndexBody(out);
- out << "</html>\n";
-}
-
+ out << HTTPOKHTML;
+ out << "<html>\n";
+ IndexMonPage->OutputHead(out);
+ OutputIndexBody(out);
+ out << "</html>\n";
+}
+
void TMonService2::OutputIndexBody(IOutputStream& out) {
- out << "<body>\n";
-
- // part of common navbar
- out << "<ol class='breadcrumb'>\n";
- out << "<li class='active'>" << Title << "</li>\n";
- out << "</ol>\n";
-
- out << "<div class='container'>\n"
- << "<h2>" << Title << "</h2>\n";
- OutputIndex(out);
- out
- << "<div>\n"
- << "</body>\n";
-}
-
+ out << "<body>\n";
+
+ // part of common navbar
+ out << "<ol class='breadcrumb'>\n";
+ out << "<li class='active'>" << Title << "</li>\n";
+ out << "</ol>\n";
+
+ out << "<div class='container'>\n"
+ << "<h2>" << Title << "</h2>\n";
+ OutputIndex(out);
+ out
+ << "<div>\n"
+ << "</body>\n";
+}
+
void TMonService2::ServeRequest(IOutputStream& out, const NMonitoring::IHttpRequest& request) {
TString path = request.GetPath();
Y_VERIFY(path.StartsWith('/'));
@@ -95,34 +95,34 @@ void TMonService2::ServeRequest(IOutputStream& out, const NMonitoring::IHttpRequ
}
}
- if (path == "/") {
- OutputIndexPage(out);
- } else {
- TMonService2HttpRequest monService2HttpRequest(
+ if (path == "/") {
+ OutputIndexPage(out);
+ } else {
+ TMonService2HttpRequest monService2HttpRequest(
&out, &request, this, IndexMonPage.Get(), path, nullptr);
- IndexMonPage->Output(monService2HttpRequest);
- }
-}
-
+ IndexMonPage->Output(monService2HttpRequest);
+ }
+}
+
void TMonService2::Register(IMonPage* page) {
- IndexMonPage->Register(page);
-}
-
+ IndexMonPage->Register(page);
+}
+
void TMonService2::Register(TMonPagePtr page) {
IndexMonPage->Register(std::move(page));
}
TIndexMonPage* TMonService2::RegisterIndexPage(const TString& path, const TString& title) {
return IndexMonPage->RegisterIndexPage(path, title);
-}
-
+}
+
IMonPage* TMonService2::FindPage(const TString& relativePath) {
- return IndexMonPage->FindPage(relativePath);
-}
-
+ return IndexMonPage->FindPage(relativePath);
+}
+
TIndexMonPage* TMonService2::FindIndexPage(const TString& relativePath) {
- return IndexMonPage->FindIndexPage(relativePath);
-}
+ return IndexMonPage->FindIndexPage(relativePath);
+}
void TMonService2::SortPages() {
IndexMonPage->SortPages();