diff options
author | a-romanov <a-romanov@yandex-team.ru> | 2022-02-10 16:48:11 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:11 +0300 |
commit | 0f4c5d1e8c0672bf0a1f2f2d8acac5ba24772435 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/monlib | |
parent | aa2986a34bde73b2cdcea5080c4443b7cf2ba686 (diff) | |
download | ydb-0f4c5d1e8c0672bf0a1f2f2d8acac5ba24772435.tar.gz |
Restoring authorship annotation for <a-romanov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib')
-rw-r--r-- | library/cpp/monlib/counters/counters.h | 2 | ||||
-rw-r--r-- | library/cpp/monlib/dynamic_counters/counters.cpp | 8 | ||||
-rw-r--r-- | library/cpp/monlib/dynamic_counters/counters.h | 4 | ||||
-rw-r--r-- | library/cpp/monlib/dynamic_counters/page.cpp | 40 | ||||
-rw-r--r-- | library/cpp/monlib/dynamic_counters/page.h | 6 | ||||
-rw-r--r-- | library/cpp/monlib/service/monservice.h | 2 | ||||
-rw-r--r-- | library/cpp/monlib/service/pages/html_mon_page.cpp | 8 | ||||
-rw-r--r-- | library/cpp/monlib/service/pages/html_mon_page.h | 2 | ||||
-rw-r--r-- | library/cpp/monlib/service/pages/templates.cpp | 6 | ||||
-rw-r--r-- | library/cpp/monlib/service/pages/templates.h | 8 | ||||
-rw-r--r-- | library/cpp/monlib/service/service.cpp | 2 |
11 files changed, 44 insertions, 44 deletions
diff --git a/library/cpp/monlib/counters/counters.h b/library/cpp/monlib/counters/counters.h index 70985948f9..038b55f0c8 100644 --- a/library/cpp/monlib/counters/counters.h +++ b/library/cpp/monlib/counters/counters.h @@ -55,7 +55,7 @@ namespace NMonitoring { bool ForDerivative() const { return Derivative; } - + operator TValueBase() const { return AtomicGet(Value); } diff --git a/library/cpp/monlib/dynamic_counters/counters.cpp b/library/cpp/monlib/dynamic_counters/counters.cpp index 08eb6faa13..3635d87d0d 100644 --- a/library/cpp/monlib/dynamic_counters/counters.cpp +++ b/library/cpp/monlib/dynamic_counters/counters.cpp @@ -157,8 +157,8 @@ void TDynamicCounters::MergeWithSubgroup(const TString& name, const TString& val Counters.erase(it); Counters.merge(subgroup->Resign()); AtomicAdd(ExpiringCount, AtomicSwap(&subgroup->ExpiringCount, 0)); -} - +} + void TDynamicCounters::ResetCounters(bool derivOnly) { TReadGuard g(Lock); for (auto& [key, value] : Counters) { @@ -198,7 +198,7 @@ void TDynamicCounters::EnumerateSubgroups(const std::function<void(const TString output(key.LabelName, key.LabelValue); } } -} +} void TDynamicCounters::OutputPlainText(IOutputStream& os, const TString& indent) const { auto snap = ReadSnapshot(); @@ -206,7 +206,7 @@ void TDynamicCounters::OutputPlainText(IOutputStream& os, const TString& indent) auto outputVisibilityMarker = [] (EVisibility vis) { return vis == EVisibility::Private ? "\t[PRIVATE]" : ""; }; - + for (const auto& [key, value] : snap) { if (const auto counter = AsCounter(value)) { os << indent diff --git a/library/cpp/monlib/dynamic_counters/counters.h b/library/cpp/monlib/dynamic_counters/counters.h index fd8f530854..dc178cfbe0 100644 --- a/library/cpp/monlib/dynamic_counters/counters.h +++ b/library/cpp/monlib/dynamic_counters/counters.h @@ -12,7 +12,7 @@ #include <util/string/cast.h> #include <util/system/rwlock.h> -#include <functional> +#include <functional> namespace NMonitoring { struct TCounterForPtr; @@ -333,7 +333,7 @@ namespace NMonitoring { TIntrusivePtr<TDynamicCounters> FindSubgroup(const TString& name, const TString& value) const; void RemoveSubgroup(const TString& name, const TString& value); void ReplaceSubgroup(const TString& name, const TString& value, TIntrusivePtr<TDynamicCounters> subgroup); - + // Move all counters from specified subgroup and remove the subgroup. void MergeWithSubgroup(const TString& name, const TString& value); // Recursively reset all/deriv counters to 0. diff --git a/library/cpp/monlib/dynamic_counters/page.cpp b/library/cpp/monlib/dynamic_counters/page.cpp index 0dc63f149e..5124a47bb3 100644 --- a/library/cpp/monlib/dynamic_counters/page.cpp +++ b/library/cpp/monlib/dynamic_counters/page.cpp @@ -5,15 +5,15 @@ #include <library/cpp/string_utils/quote/quote.h> #include <util/string/split.h> -#include <util/system/tls.h> +#include <util/system/tls.h> using namespace NMonitoring; namespace { Y_POD_STATIC_THREAD(TDynamicCounters*) currentCounters(nullptr); -} - +} + TMaybe<EFormat> ParseFormat(TStringBuf str) { if (str == TStringBuf("json")) { return EFormat::JSON; @@ -40,38 +40,38 @@ void TDynamicCountersPage::Output(NMonitoring::IMonHttpRequest& request) { .Split('/') .SkipEmpty() .Collect(&parts); - + TMaybe<EFormat> format = !parts.empty() ? ParseFormat(parts.back()) : Nothing(); if (format) { - parts.pop_back(); + parts.pop_back(); } - + if (!parts.empty() && parts.back() == TStringBuf("private")) { visibility = TCountableBase::EVisibility::Private; parts.pop_back(); } - auto counters = Counters; - + auto counters = Counters; + for (const auto& escaped : parts) { const auto part = CGIUnescapeRet(escaped); TVector<TString> labels; StringSplitter(part).Split('=').SkipEmpty().Collect(&labels); - - if (labels.size() != 2U) - return NotFound(request); - + + if (labels.size() != 2U) + return NotFound(request); + if (const auto child = counters->FindSubgroup( labels.front(), labels.back())) { - counters = child; + counters = child; } else { return HandleAbsentSubgroup(request); } - } - + } + if (!format) { currentCounters = counters.Get(); THtmlMonPage::Output(request); @@ -94,7 +94,7 @@ void TDynamicCountersPage::Output(NMonitoring::IMonHttpRequest& request) { counters->Accept(TString(), TString(), *encoder); out.Flush(); } - + void TDynamicCountersPage::HandleAbsentSubgroup(IMonHttpRequest& request) { if (UnknownGroupPolicy == EUnknownGroupPolicy::Error) { NotFound(request); @@ -112,7 +112,7 @@ void TDynamicCountersPage::BeforePre(IMonHttpRequest& request) { out << "<a href='" << request.GetPath() << "/json'>Counters as JSON</a>"; out << " for <a href='https://wiki.yandex-team.ru/solomon/'>Solomon</a>"; } - + H5() { out << "Counters subgroups"; } @@ -125,15 +125,15 @@ void TDynamicCountersPage::BeforePre(IMonHttpRequest& request) { } }); } - + H4() { out << "Counters as text"; } } -} +} void TDynamicCountersPage::OutputText(IOutputStream& out, IMonHttpRequest&) { - currentCounters->OutputPlainText(out); + currentCounters->OutputPlainText(out); } void TDynamicCountersPage::SetUnknownGroupPolicy(EUnknownGroupPolicy value) { diff --git a/library/cpp/monlib/dynamic_counters/page.h b/library/cpp/monlib/dynamic_counters/page.h index 61ae703907..1f0ef6a5ea 100644 --- a/library/cpp/monlib/dynamic_counters/page.h +++ b/library/cpp/monlib/dynamic_counters/page.h @@ -19,7 +19,7 @@ namespace NMonitoring { using TOutputCallback = std::function<void()>; private: - const TIntrusivePtr<TDynamicCounters> Counters; + const TIntrusivePtr<TDynamicCounters> Counters; TOutputCallback OutputCallback; EUnknownGroupPolicy UnknownGroupPolicy {EUnknownGroupPolicy::Error}; @@ -40,11 +40,11 @@ namespace NMonitoring { void Output(NMonitoring::IMonHttpRequest& request) override; void BeforePre(NMonitoring::IMonHttpRequest& request) override; - + void OutputText(IOutputStream& out, NMonitoring::IMonHttpRequest&) override; /// If set to Error, responds with 404 if the requested subgroup is not found. This is the default. /// If set to Ignore, responds with 204 if the requested subgroup is not found void SetUnknownGroupPolicy(EUnknownGroupPolicy value); - }; + }; } diff --git a/library/cpp/monlib/service/monservice.h b/library/cpp/monlib/service/monservice.h index 543a07d143..8f5e52fcdb 100644 --- a/library/cpp/monlib/service/monservice.h +++ b/library/cpp/monlib/service/monservice.h @@ -9,7 +9,7 @@ #include <util/system/progname.h> -#include <functional> +#include <functional> namespace NMonitoring { class TMonService2: public TMtHttpServer { diff --git a/library/cpp/monlib/service/pages/html_mon_page.cpp b/library/cpp/monlib/service/pages/html_mon_page.cpp index 5dc9eed1fd..eb4eb3b66c 100644 --- a/library/cpp/monlib/service/pages/html_mon_page.cpp +++ b/library/cpp/monlib/service/pages/html_mon_page.cpp @@ -46,12 +46,12 @@ void THtmlMonPage::Output(NMonitoring::IMonHttpRequest& request) { } } } - + void THtmlMonPage::NotFound(NMonitoring::IMonHttpRequest& request) const { IOutputStream& out = request.Output(); - out << HTTPNOTFOUND; - out.Flush(); -} + out << HTTPNOTFOUND; + out.Flush(); +} void THtmlMonPage::NoContent(NMonitoring::IMonHttpRequest& request) const { IOutputStream& out = request.Output(); diff --git a/library/cpp/monlib/service/pages/html_mon_page.h b/library/cpp/monlib/service/pages/html_mon_page.h index 07fc883f44..e87c53b62b 100644 --- a/library/cpp/monlib/service/pages/html_mon_page.h +++ b/library/cpp/monlib/service/pages/html_mon_page.h @@ -16,7 +16,7 @@ namespace NMonitoring { void NotFound(NMonitoring::IMonHttpRequest& request) const; void NoContent(NMonitoring::IMonHttpRequest& request) const; - + virtual void OutputContent(NMonitoring::IMonHttpRequest& request) = 0; bool OutputTableSorterJsCss; diff --git a/library/cpp/monlib/service/pages/templates.cpp b/library/cpp/monlib/service/pages/templates.cpp index 132507f68b..ece12bea71 100644 --- a/library/cpp/monlib/service/pages/templates.cpp +++ b/library/cpp/monlib/service/pages/templates.cpp @@ -25,9 +25,9 @@ namespace NMonitoring { extern const char H6Tag[] = "h6"; extern const char SmallTag[] = "small"; extern const char StrongTag[] = "strong"; - extern const char ListTag[] = "li"; - extern const char UListTag[] = "ul"; - extern const char OListTag[] = "ol"; + extern const char ListTag[] = "li"; + extern const char UListTag[] = "ul"; + extern const char OListTag[] = "ol"; extern const char DListTag[] = "dl"; 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 f9240d968b..b4656f059f 100644 --- a/library/cpp/monlib/service/pages/templates.h +++ b/library/cpp/monlib/service/pages/templates.h @@ -70,7 +70,7 @@ #define SMALL() TAG(TSMALL) #define STRONG() TAG(TSTRONG) - + #define LI() TAG(TLIST) #define LI_CLASS(cls) TAG_CLASS(TLIST, cls) #define UL() TAG(TULIST) @@ -259,9 +259,9 @@ namespace NMonitoring { typedef TTag<H6Tag> TH6; typedef TTag<SmallTag> TSMALL; typedef TTag<StrongTag> TSTRONG; - typedef TTag<ListTag> TLIST; - typedef TTag<UListTag> TULIST; - typedef TTag<OListTag> TOLIST; + typedef TTag<ListTag> TLIST; + typedef TTag<UListTag> TULIST; + typedef TTag<OListTag> TOLIST; typedef TTag<DListTag> DLIST; typedef TTag<DTermTag> DTERM; typedef TTag<DDescTag> DDESC; diff --git a/library/cpp/monlib/service/service.cpp b/library/cpp/monlib/service/service.cpp index 8142d16cff..929efbf816 100644 --- a/library/cpp/monlib/service/service.cpp +++ b/library/cpp/monlib/service/service.cpp @@ -242,7 +242,7 @@ namespace NMonitoring { 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)) + , MtServer(THttpServerOptions(externalPort), std::bind(&TMonService::DispatchRequest, this, std::placeholders::_1, std::placeholders::_2)) , MtHandler(std::move(mtHandler)) { } |