Browse Source

Restoring authorship annotation for <msherbakov@yandex-team.ru>. Commit 2 of 2.

msherbakov 3 years ago
parent
commit
a0ffafe83b

+ 1 - 1
library/cpp/actors/core/actor.h

@@ -234,7 +234,7 @@ namespace NActors {
             INTERCONNECT_SESSION_TCP = 13,
             INTERCONNECT_COMMON = 171,
             SELF_PING_ACTOR = 207,
-            TEST_ACTOR_RUNTIME = 283, 
+            TEST_ACTOR_RUNTIME = 283,
             INTERCONNECT_HANDSHAKE = 284,
             INTERCONNECT_POLLER = 285,
             INTERCONNECT_SESSION_KILLER = 286,

+ 40 - 40
library/cpp/actors/core/log.cpp

@@ -217,8 +217,8 @@ namespace NActors {
             TString formatted;
             vsprintf(formatted, c, params);
 
-            auto ok = OutputRecord(time, NLog::EPrio(priority), component, formatted); 
-            Y_UNUSED(ok); 
+            auto ok = OutputRecord(time, NLog::EPrio(priority), component, formatted);
+            Y_UNUSED(ok);
             va_end(params);
         }
     }
@@ -230,9 +230,9 @@ namespace NActors {
 
     void TLoggerActor::LogIgnoredCount(TInstant now) {
         TString message = Sprintf("Ignored IgnoredCount# %" PRIu64 " log records due to logger overflow!", IgnoredCount);
-        if (!OutputRecord(now, NActors::NLog::EPrio::Error, Settings->LoggerComponent, message)) { 
-            BecomeDefunct(); 
-        } 
+        if (!OutputRecord(now, NActors::NLog::EPrio::Error, Settings->LoggerComponent, message)) {
+            BecomeDefunct();
+        }
     }
 
     void TLoggerActor::HandleIgnoredEvent(TLogIgnored::TPtr& ev, const NActors::TActorContext& ctx) {
@@ -242,14 +242,14 @@ namespace NActors {
         PassedCount = 0;
     }
 
-    void TLoggerActor::HandleIgnoredEventDrop() { 
-        // logger backend is unavailable, just ignore 
-    } 
- 
-    void TLoggerActor::WriteMessageStat(const NLog::TEvLog& ev) { 
+    void TLoggerActor::HandleIgnoredEventDrop() {
+        // logger backend is unavailable, just ignore
+    }
+
+    void TLoggerActor::WriteMessageStat(const NLog::TEvLog& ev) {
         Metrics->IncActorMsgs();
 
-        const auto prio = ev.Level.ToPrio(); 
+        const auto prio = ev.Level.ToPrio();
 
         switch (prio) {
             case ::NActors::NLog::EPrio::Alert:
@@ -262,11 +262,11 @@ namespace NActors {
                 break;
         }
 
-    } 
- 
-    void TLoggerActor::HandleLogEvent(NLog::TEvLog::TPtr& ev, const NActors::TActorContext& ctx) { 
-        i64 delayMillisec = (ctx.Now() - ev->Get()->Stamp).MilliSeconds(); 
-        WriteMessageStat(*ev->Get()); 
+    }
+
+    void TLoggerActor::HandleLogEvent(NLog::TEvLog::TPtr& ev, const NActors::TActorContext& ctx) {
+        i64 delayMillisec = (ctx.Now() - ev->Get()->Stamp).MilliSeconds();
+        WriteMessageStat(*ev->Get());
         if (Settings->AllowDrop) {
             // Disable throttling if it was enabled previously
             if (AtomicGet(IsOverflow))
@@ -291,17 +291,17 @@ namespace NActors {
                 AtomicSet(IsOverflow, 0);
         }
 
-        const auto prio = ev->Get()->Level.ToPrio(); 
-        if (!OutputRecord(ev->Get()->Stamp, prio, ev->Get()->Component, ev->Get()->Line)) { 
-            BecomeDefunct(); 
-        } 
+        const auto prio = ev->Get()->Level.ToPrio();
+        if (!OutputRecord(ev->Get()->Stamp, prio, ev->Get()->Component, ev->Get()->Line)) {
+            BecomeDefunct();
+        }
+    }
+
+    void TLoggerActor::BecomeDefunct() {
+        Become(&TThis::StateDefunct);
+        Schedule(WakeupInterval, new TEvents::TEvWakeup);
     }
 
-    void TLoggerActor::BecomeDefunct() { 
-        Become(&TThis::StateDefunct); 
-        Schedule(WakeupInterval, new TEvents::TEvWakeup); 
-    } 
- 
     void TLoggerActor::HandleLogComponentLevelRequest(TLogComponentLevelRequest::TPtr& ev, const NActors::TActorContext& ctx) {
         Metrics->IncLevelRequests();
         TString explanation;
@@ -367,7 +367,7 @@ namespace NActors {
      * 4. Log level changes (last N changes)
      */
     void TLoggerActor::HandleMonInfo(NMon::TEvHttpInfo::TPtr& ev, const TActorContext& ctx) {
-        const auto& params = ev->Get()->Request.GetParams(); 
+        const auto& params = ev->Get()->Request.GetParams();
         NLog::EComponent component = NLog::InvalidComponent;
         NLog::EPriority priority = NLog::PRI_DEBUG;
         NLog::EPriority samplingPriority = NLog::PRI_DEBUG;
@@ -574,8 +574,8 @@ namespace NActors {
 
     constexpr size_t TimeBufSize = 512;
 
-    bool TLoggerActor::OutputRecord(TInstant time, NLog::EPrio priority, NLog::EComponent component, 
-                                    const TString& formatted) noexcept try { 
+    bool TLoggerActor::OutputRecord(TInstant time, NLog::EPrio priority, NLog::EComponent component,
+                                    const TString& formatted) noexcept try {
         const auto logPrio = ::ELogPriority(ui16(priority));
 
         char buf[TimeBufSize];
@@ -634,21 +634,21 @@ namespace NActors {
                     TLogRecord(logPrio, logRecord.data(), logRecord.size()));
             } break;
         }
- 
-        return true; 
-    } catch (...) { 
-        return false; 
+
+        return true;
+    } catch (...) {
+        return false;
     }
 
-    void TLoggerActor::HandleLogEventDrop(const NLog::TEvLog::TPtr& ev) { 
-        WriteMessageStat(*ev->Get()); 
+    void TLoggerActor::HandleLogEventDrop(const NLog::TEvLog::TPtr& ev) {
+        WriteMessageStat(*ev->Get());
         Metrics->IncDroppedMsgs();
-    } 
- 
-    void TLoggerActor::HandleWakeup() { 
-        Become(&TThis::StateFunc); 
-    } 
- 
+    }
+
+    void TLoggerActor::HandleWakeup() {
+        Become(&TThis::StateFunc);
+    }
+
     const char* TLoggerActor::FormatLocalTimestamp(TInstant time, char* buf) {
         struct tm localTime;
         time.LocalTime(&localTime);

+ 38 - 38
library/cpp/actors/core/log.h

@@ -219,16 +219,16 @@ namespace NActors {
             }
         }
 
-        STFUNC(StateDefunct) { 
-            switch (ev->GetTypeRewrite()) { 
-                cFunc(TLogIgnored::EventType, HandleIgnoredEventDrop); 
-                hFunc(NLog::TEvLog, HandleLogEventDrop); 
-                HFunc(TLogComponentLevelRequest, HandleLogComponentLevelRequest); 
-                HFunc(NMon::TEvHttpInfo, HandleMonInfo); 
-                cFunc(TEvents::TEvWakeup::EventType, HandleWakeup); 
-            } 
-        } 
- 
+        STFUNC(StateDefunct) {
+            switch (ev->GetTypeRewrite()) {
+                cFunc(TLogIgnored::EventType, HandleIgnoredEventDrop);
+                hFunc(NLog::TEvLog, HandleLogEventDrop);
+                HFunc(TLogComponentLevelRequest, HandleLogComponentLevelRequest);
+                HFunc(NMon::TEvHttpInfo, HandleMonInfo);
+                cFunc(TEvents::TEvWakeup::EventType, HandleWakeup);
+            }
+        }
+
         // Directly call logger instead of sending a message
         void Log(TInstant time, NLog::EPriority priority, NLog::EComponent component, const char* c, ...);
 
@@ -240,21 +240,21 @@ namespace NActors {
         ui64 IgnoredCount = 0;
         ui64 PassedCount = 0;
         static TAtomic IsOverflow;
-        TDuration WakeupInterval{TDuration::Seconds(5)}; 
+        TDuration WakeupInterval{TDuration::Seconds(5)};
         std::unique_ptr<ILoggerMetrics> Metrics;
 
-        void BecomeDefunct(); 
+        void BecomeDefunct();
         void HandleIgnoredEvent(TLogIgnored::TPtr& ev, const NActors::TActorContext& ctx);
-        void HandleIgnoredEventDrop(); 
+        void HandleIgnoredEventDrop();
         void HandleLogEvent(NLog::TEvLog::TPtr& ev, const TActorContext& ctx);
-        void HandleLogEventDrop(const NLog::TEvLog::TPtr& ev); 
+        void HandleLogEventDrop(const NLog::TEvLog::TPtr& ev);
         void HandleLogComponentLevelRequest(TLogComponentLevelRequest::TPtr& ev, const TActorContext& ctx);
         void HandleMonInfo(NMon::TEvHttpInfo::TPtr& ev, const TActorContext& ctx);
-        void HandleWakeup(); 
-        [[nodiscard]] bool OutputRecord(TInstant time, NLog::EPrio priority, NLog::EComponent component, const TString& formatted) noexcept; 
+        void HandleWakeup();
+        [[nodiscard]] bool OutputRecord(TInstant time, NLog::EPrio priority, NLog::EComponent component, const TString& formatted) noexcept;
         void RenderComponentPriorities(IOutputStream& str);
         void LogIgnoredCount(TInstant now);
-        void WriteMessageStat(const NLog::TEvLog& ev); 
+        void WriteMessageStat(const NLog::TEvLog& ev);
         static const char* FormatLocalTimestamp(TInstant time, char* buf);
     };
 
@@ -305,19 +305,19 @@ namespace NActors {
     //  Logging adaptors for memory log and logging into filesystem
     /////////////////////////////////////////////////////////////////////
 
-    namespace NDetail { 
-        inline void Y_PRINTF_FORMAT(2, 3) PrintfV(TString& dst, const char* format, ...) { 
-            va_list params; 
-            va_start(params, format); 
-            vsprintf(dst, format, params); 
-            va_end(params); 
-        } 
-
-        inline void PrintfV(TString& dst, const char* format, va_list params) { 
-            vsprintf(dst, format, params); 
-        } 
-    } // namespace NDetail 
- 
+    namespace NDetail {
+        inline void Y_PRINTF_FORMAT(2, 3) PrintfV(TString& dst, const char* format, ...) {
+            va_list params;
+            va_start(params, format);
+            vsprintf(dst, format, params);
+            va_end(params);
+        }
+
+        inline void PrintfV(TString& dst, const char* format, va_list params) {
+            vsprintf(dst, format, params);
+        }
+    } // namespace NDetail
+
     template <typename TCtx>
     inline void DeliverLogMessage(TCtx& ctx, NLog::EPriority mPriority, NLog::EComponent mComponent, TString &&str)
     {
@@ -326,21 +326,21 @@ namespace NActors {
         ctx.Send(new IEventHandle(mSettings->LoggerActorId, TActorId(), new NLog::TEvLog(mPriority, mComponent, std::move(str))));
     }
 
-    template <typename TCtx, typename... TArgs> 
+    template <typename TCtx, typename... TArgs>
     inline void MemLogAdapter(
         TCtx& actorCtxOrSystem,
         NLog::EPriority mPriority,
         NLog::EComponent mComponent,
-        const char* format, TArgs&&... params) { 
+        const char* format, TArgs&&... params) {
         TString Formatted;
 
 
-        if constexpr (sizeof... (params) > 0) { 
-            NDetail::PrintfV(Formatted, format, std::forward<TArgs>(params)...); 
-        } else { 
-            NDetail::PrintfV(Formatted, "%s", format); 
-        } 
- 
+        if constexpr (sizeof... (params) > 0) {
+            NDetail::PrintfV(Formatted, format, std::forward<TArgs>(params)...);
+        } else {
+            NDetail::PrintfV(Formatted, "%s", format);
+        }
+
         MemLogWrite(Formatted.data(), Formatted.size(), true);
         DeliverLogMessage(actorCtxOrSystem, mPriority, mComponent, std::move(Formatted));
     }

+ 125 - 125
library/cpp/actors/core/log_ut.cpp

@@ -1,27 +1,27 @@
-#include "log.h" 
- 
+#include "log.h"
+
 #include <library/cpp/testing/unittest/registar.h>
- 
+
 #include <library/cpp/actors/testlib/test_runtime.h>
- 
-using namespace NMonitoring; 
-using namespace NActors; 
-using namespace NActors::NLog; 
- 
-namespace { 
-    const TString& ServiceToString(int) { 
-        static const TString FAKE{"FAKE"}; 
-        return FAKE; 
-    } 
- 
-    TIntrusivePtr<TSettings> DefaultSettings() { 
+
+using namespace NMonitoring;
+using namespace NActors;
+using namespace NActors::NLog;
+
+namespace {
+    const TString& ServiceToString(int) {
+        static const TString FAKE{"FAKE"};
+        return FAKE;
+    }
+
+    TIntrusivePtr<TSettings> DefaultSettings() {
         auto loggerId = TActorId{0, "Logger"};
-        auto s = MakeIntrusive<TSettings>(loggerId, 0, EPriority::PRI_TRACE); 
-        s->SetAllowDrop(false); 
-        s->Append(0, 1, ServiceToString); 
-        return s; 
-    } 
- 
+        auto s = MakeIntrusive<TSettings>(loggerId, 0, EPriority::PRI_TRACE);
+        s->SetAllowDrop(false);
+        s->Append(0, 1, ServiceToString);
+        return s;
+    }
+
     TIntrusivePtr<TSettings> DroppingSettings(ui64 timeThresholdMs) {
         auto loggerId = TActorId{0, "Logger"};
         auto s = MakeIntrusive<TSettings>(
@@ -35,123 +35,123 @@ namespace {
         return s;
     }
 
-    class TMockBackend: public TLogBackend { 
-    public: 
-        using TWriteImpl = std::function<void(const TLogRecord&)>; 
-        using TReopenImpl = std::function<void()>; 
- 
-        static void REOPEN_NOP() { } 
- 
-        TMockBackend(TWriteImpl writeImpl, TReopenImpl reopenImpl = REOPEN_NOP) 
-             : WriteImpl_{writeImpl} 
-             , ReopenImpl_{reopenImpl} 
-         { 
-         } 
- 
-        void WriteData(const TLogRecord& r) override { 
-            WriteImpl_(r); 
-        } 
- 
-        void ReopenLog() override { } 
- 
-        void SetWriteImpl(TWriteImpl writeImpl) { 
-            WriteImpl_ = writeImpl; 
-        } 
- 
-    private: 
-        TWriteImpl WriteImpl_; 
-        TReopenImpl ReopenImpl_; 
-    }; 
- 
-    void ThrowAlways(const TLogRecord&) { 
-        ythrow yexception(); 
-    }; 
- 
-    struct TFixture { 
+    class TMockBackend: public TLogBackend {
+    public:
+        using TWriteImpl = std::function<void(const TLogRecord&)>;
+        using TReopenImpl = std::function<void()>;
+
+        static void REOPEN_NOP() { }
+
+        TMockBackend(TWriteImpl writeImpl, TReopenImpl reopenImpl = REOPEN_NOP)
+             : WriteImpl_{writeImpl}
+             , ReopenImpl_{reopenImpl}
+         {
+         }
+
+        void WriteData(const TLogRecord& r) override {
+            WriteImpl_(r);
+        }
+
+        void ReopenLog() override { }
+
+        void SetWriteImpl(TWriteImpl writeImpl) {
+            WriteImpl_ = writeImpl;
+        }
+
+    private:
+        TWriteImpl WriteImpl_;
+        TReopenImpl ReopenImpl_;
+    };
+
+    void ThrowAlways(const TLogRecord&) {
+        ythrow yexception();
+    };
+
+    struct TFixture {
         TFixture(
             TIntrusivePtr<TSettings> settings,
             TMockBackend::TWriteImpl writeImpl = ThrowAlways)
         {
-            Runtime.Initialize(); 
-            LogBackend.reset(new TMockBackend{writeImpl}); 
+            Runtime.Initialize();
+            LogBackend.reset(new TMockBackend{writeImpl});
             LoggerActor = Runtime.Register(new TLoggerActor{settings, LogBackend, Counters});
-            Runtime.SetScheduledEventFilter([] (auto&&, auto&&, auto&&, auto) { 
-                return false; 
-            }); 
-        } 
- 
+            Runtime.SetScheduledEventFilter([] (auto&&, auto&&, auto&&, auto) {
+                return false;
+            });
+        }
+
         TFixture(TMockBackend::TWriteImpl writeImpl = ThrowAlways)
             : TFixture(DefaultSettings(), writeImpl)
         {}
 
-        void WriteLog() { 
-            Runtime.Send(new IEventHandle{LoggerActor, {}, new TEvLog(TInstant::Zero(), TLevel{EPrio::Emerg}, 0, "foo")}); 
-        } 
- 
+        void WriteLog() {
+            Runtime.Send(new IEventHandle{LoggerActor, {}, new TEvLog(TInstant::Zero(), TLevel{EPrio::Emerg}, 0, "foo")});
+        }
+
         void WriteLog(TInstant ts) {
             Runtime.Send(new IEventHandle{LoggerActor, {}, new TEvLog(ts, TLevel{EPrio::Emerg}, 0, "foo")});
         }
 
-        void Wakeup() { 
-            Runtime.Send(new IEventHandle{LoggerActor, {}, new TEvents::TEvWakeup}); 
-        } 
- 
-        TIntrusivePtr<TDynamicCounters> Counters{MakeIntrusive<TDynamicCounters>()}; 
-        std::shared_ptr<TMockBackend> LogBackend; 
+        void Wakeup() {
+            Runtime.Send(new IEventHandle{LoggerActor, {}, new TEvents::TEvWakeup});
+        }
+
+        TIntrusivePtr<TDynamicCounters> Counters{MakeIntrusive<TDynamicCounters>()};
+        std::shared_ptr<TMockBackend> LogBackend;
         TActorId LoggerActor;
-        TTestActorRuntimeBase Runtime; 
-    }; 
-} 
- 
- 
-Y_UNIT_TEST_SUITE(TLoggerActorTest) { 
-    Y_UNIT_TEST(NoCrashOnWriteFailure) { 
-        TFixture test; 
-        test.WriteLog(); 
-        // everything is okay as long as we get here 
-    } 
- 
-    Y_UNIT_TEST(SubsequentWritesAreIgnored) { 
-        size_t count{0}; 
-        auto countWrites = [&count] (auto&& r) { 
-            count++; 
-            ThrowAlways(r); 
-        }; 
- 
-        TFixture test{countWrites}; 
-        test.WriteLog(); 
-        UNIT_ASSERT_VALUES_EQUAL(count, 1); 
- 
-        // at this point we should have started dropping messages 
-        for (auto i = 0; i < 5; ++i) { 
-            test.WriteLog(); 
-        } 
- 
-        UNIT_ASSERT_VALUES_EQUAL(count, 1); 
-    } 
- 
-    Y_UNIT_TEST(LoggerCanRecover) { 
-        TFixture test; 
-        test.WriteLog(); 
- 
-        TVector<TString> messages; 
-        auto acceptWrites = [&] (const TLogRecord& r) { 
-            messages.emplace_back(r.Data, r.Len); 
-        }; 
- 
-        auto scheduled = test.Runtime.CaptureScheduledEvents(); 
-        UNIT_ASSERT_VALUES_EQUAL(scheduled.size(), 1); 
- 
-        test.LogBackend->SetWriteImpl(acceptWrites); 
-        test.Wakeup(); 
- 
-        const auto COUNT = 10; 
-        for (auto i = 0; i < COUNT; ++i) { 
-            test.WriteLog(); 
-        } 
- 
-        UNIT_ASSERT_VALUES_EQUAL(messages.size(), COUNT); 
-    } 
+        TTestActorRuntimeBase Runtime;
+    };
+}
+
+
+Y_UNIT_TEST_SUITE(TLoggerActorTest) {
+    Y_UNIT_TEST(NoCrashOnWriteFailure) {
+        TFixture test;
+        test.WriteLog();
+        // everything is okay as long as we get here
+    }
+
+    Y_UNIT_TEST(SubsequentWritesAreIgnored) {
+        size_t count{0};
+        auto countWrites = [&count] (auto&& r) {
+            count++;
+            ThrowAlways(r);
+        };
+
+        TFixture test{countWrites};
+        test.WriteLog();
+        UNIT_ASSERT_VALUES_EQUAL(count, 1);
+
+        // at this point we should have started dropping messages
+        for (auto i = 0; i < 5; ++i) {
+            test.WriteLog();
+        }
+
+        UNIT_ASSERT_VALUES_EQUAL(count, 1);
+    }
+
+    Y_UNIT_TEST(LoggerCanRecover) {
+        TFixture test;
+        test.WriteLog();
+
+        TVector<TString> messages;
+        auto acceptWrites = [&] (const TLogRecord& r) {
+            messages.emplace_back(r.Data, r.Len);
+        };
+
+        auto scheduled = test.Runtime.CaptureScheduledEvents();
+        UNIT_ASSERT_VALUES_EQUAL(scheduled.size(), 1);
+
+        test.LogBackend->SetWriteImpl(acceptWrites);
+        test.Wakeup();
+
+        const auto COUNT = 10;
+        for (auto i = 0; i < COUNT; ++i) {
+            test.WriteLog();
+        }
+
+        UNIT_ASSERT_VALUES_EQUAL(messages.size(), COUNT);
+    }
 
     Y_UNIT_TEST(ShouldObeyTimeThresholdMsWhenOverloaded) {
         TFixture test{DroppingSettings(5000)};
@@ -182,4 +182,4 @@ Y_UNIT_TEST_SUITE(TLoggerActorTest) {
 
         UNIT_ASSERT_VALUES_EQUAL(messages.size(), COUNT + 1);
     }
-} 
+}

+ 3 - 3
library/cpp/actors/core/mon.h

@@ -21,20 +21,20 @@ namespace NActors {
 
         // request info from an actor in HTML format
         struct TEvHttpInfo: public NActors::TEventLocal<TEvHttpInfo, HttpInfo> {
-            TEvHttpInfo(const NMonitoring::IMonHttpRequest& request, int subReqId = 0) 
+            TEvHttpInfo(const NMonitoring::IMonHttpRequest& request, int subReqId = 0)
                 : Request(request)
                 , SubRequestId(subReqId)
             {
             }
 
-            TEvHttpInfo(const NMonitoring::IMonHttpRequest& request, const TString& userToken) 
+            TEvHttpInfo(const NMonitoring::IMonHttpRequest& request, const TString& userToken)
                 : Request(request)
                 , UserToken(userToken)
                 , SubRequestId(0)
             {
             }
 
-            const NMonitoring::IMonHttpRequest& Request; 
+            const NMonitoring::IMonHttpRequest& Request;
             TString UserToken; // built and serialized
             // SubRequestId != 0 means that we assemble reply from multiple parts and SubRequestId contains this part id
             int SubRequestId;

+ 78 - 78
library/cpp/actors/core/process_stats.cpp

@@ -136,23 +136,23 @@ namespace NActors {
 
 #endif
 
-namespace { 
+namespace {
     // Periodically collects process stats and exposes them as mon counters
-    template <typename TDerived> 
-    class TProcStatCollectingActor: public TActorBootstrapped<TProcStatCollectingActor<TDerived>> { 
+    template <typename TDerived>
+    class TProcStatCollectingActor: public TActorBootstrapped<TProcStatCollectingActor<TDerived>> {
     public:
         static constexpr IActor::EActivityType ActorActivityType() {
             return IActor::ACTORLIB_STATS;
         }
 
-        TProcStatCollectingActor(TDuration interval) 
-            : Interval(interval) 
+        TProcStatCollectingActor(TDuration interval)
+            : Interval(interval)
         {
         }
 
         void Bootstrap(const TActorContext& ctx) {
-            ctx.Schedule(Interval, new TEvents::TEvWakeup()); 
-            Self()->Become(&TDerived::StateWork); 
+            ctx.Schedule(Interval, new TEvents::TEvWakeup());
+            Self()->Become(&TDerived::StateWork);
         }
 
         STFUNC(StateWork) {
@@ -163,85 +163,85 @@ namespace {
 
     private:
         void Wakeup(const TActorContext& ctx) {
-            Self()->UpdateCounters(ProcStat); 
-            ctx.Schedule(Interval, new TEvents::TEvWakeup()); 
+            Self()->UpdateCounters(ProcStat);
+            ctx.Schedule(Interval, new TEvents::TEvWakeup());
         }
 
-        TDerived* Self() { 
+        TDerived* Self() {
             ProcStat.Fill(getpid());
-            return static_cast<TDerived*>(this); 
+            return static_cast<TDerived*>(this);
         }
- 
-    private: 
-        const TDuration Interval; 
-        TProcStat ProcStat; 
+
+    private:
+        const TDuration Interval;
+        TProcStat ProcStat;
     };
 
-    // Periodically collects process stats and exposes them as mon counters 
-    class TDynamicCounterCollector: public TProcStatCollectingActor<TDynamicCounterCollector> { 
-        using TBase = TProcStatCollectingActor<TDynamicCounterCollector>; 
-    public: 
+    // Periodically collects process stats and exposes them as mon counters
+    class TDynamicCounterCollector: public TProcStatCollectingActor<TDynamicCounterCollector> {
+        using TBase = TProcStatCollectingActor<TDynamicCounterCollector>;
+    public:
         TDynamicCounterCollector(
             ui32 intervalSeconds,
             NMonitoring::TDynamicCounterPtr counters)
-            : TBase{TDuration::Seconds(intervalSeconds)} 
-        { 
-            ProcStatGroup = counters->GetSubgroup("counters", "utils"); 
- 
-            VmSize = ProcStatGroup->GetCounter("Process/VmSize", false); 
-            AnonRssSize = ProcStatGroup->GetCounter("Process/AnonRssSize", false); 
-            FileRssSize = ProcStatGroup->GetCounter("Process/FileRssSize", false); 
+            : TBase{TDuration::Seconds(intervalSeconds)}
+        {
+            ProcStatGroup = counters->GetSubgroup("counters", "utils");
+
+            VmSize = ProcStatGroup->GetCounter("Process/VmSize", false);
+            AnonRssSize = ProcStatGroup->GetCounter("Process/AnonRssSize", false);
+            FileRssSize = ProcStatGroup->GetCounter("Process/FileRssSize", false);
             CGroupMemLimit = ProcStatGroup->GetCounter("Process/CGroupMemLimit", false);
-            UserTime = ProcStatGroup->GetCounter("Process/UserTime", true); 
-            SysTime = ProcStatGroup->GetCounter("Process/SystemTime", true); 
-            MinorPageFaults = ProcStatGroup->GetCounter("Process/MinorPageFaults", true); 
-            MajorPageFaults = ProcStatGroup->GetCounter("Process/MajorPageFaults", true); 
+            UserTime = ProcStatGroup->GetCounter("Process/UserTime", true);
+            SysTime = ProcStatGroup->GetCounter("Process/SystemTime", true);
+            MinorPageFaults = ProcStatGroup->GetCounter("Process/MinorPageFaults", true);
+            MajorPageFaults = ProcStatGroup->GetCounter("Process/MajorPageFaults", true);
             UptimeSeconds = ProcStatGroup->GetCounter("Process/UptimeSeconds", false);
             NumThreads = ProcStatGroup->GetCounter("Process/NumThreads", false);
             SystemUptimeSeconds = ProcStatGroup->GetCounter("System/UptimeSeconds", false);
-        } 
- 
-        void UpdateCounters(const TProcStat& procStat) { 
-            *VmSize = procStat.Vsize; 
-            *AnonRssSize = procStat.AnonRss; 
-            *FileRssSize = procStat.FileRss; 
+        }
+
+        void UpdateCounters(const TProcStat& procStat) {
+            *VmSize = procStat.Vsize;
+            *AnonRssSize = procStat.AnonRss;
+            *FileRssSize = procStat.FileRss;
             if (procStat.CGroupMemLim) {
                 *CGroupMemLimit = procStat.CGroupMemLim;
             }
-            *UserTime = procStat.Utime; 
-            *SysTime = procStat.Stime; 
-            *MinorPageFaults = procStat.MinFlt; 
-            *MajorPageFaults = procStat.MajFlt; 
+            *UserTime = procStat.Utime;
+            *SysTime = procStat.Stime;
+            *MinorPageFaults = procStat.MinFlt;
+            *MajorPageFaults = procStat.MajFlt;
             *UptimeSeconds = procStat.Uptime.Seconds();
             *NumThreads = procStat.NumThreads;
             *SystemUptimeSeconds = procStat.Uptime.Seconds();
-        } 
- 
-    private: 
+        }
+
+    private:
         NMonitoring::TDynamicCounterPtr ProcStatGroup;
-        NMonitoring::TDynamicCounters::TCounterPtr VmSize; 
-        NMonitoring::TDynamicCounters::TCounterPtr AnonRssSize; 
-        NMonitoring::TDynamicCounters::TCounterPtr FileRssSize; 
+        NMonitoring::TDynamicCounters::TCounterPtr VmSize;
+        NMonitoring::TDynamicCounters::TCounterPtr AnonRssSize;
+        NMonitoring::TDynamicCounters::TCounterPtr FileRssSize;
         NMonitoring::TDynamicCounters::TCounterPtr CGroupMemLimit;
-        NMonitoring::TDynamicCounters::TCounterPtr UserTime; 
-        NMonitoring::TDynamicCounters::TCounterPtr SysTime; 
-        NMonitoring::TDynamicCounters::TCounterPtr MinorPageFaults; 
-        NMonitoring::TDynamicCounters::TCounterPtr MajorPageFaults; 
+        NMonitoring::TDynamicCounters::TCounterPtr UserTime;
+        NMonitoring::TDynamicCounters::TCounterPtr SysTime;
+        NMonitoring::TDynamicCounters::TCounterPtr MinorPageFaults;
+        NMonitoring::TDynamicCounters::TCounterPtr MajorPageFaults;
         NMonitoring::TDynamicCounters::TCounterPtr UptimeSeconds;
         NMonitoring::TDynamicCounters::TCounterPtr NumThreads;
         NMonitoring::TDynamicCounters::TCounterPtr SystemUptimeSeconds;
-    }; 
- 
- 
-    class TRegistryCollector: public TProcStatCollectingActor<TRegistryCollector> { 
-        using TBase = TProcStatCollectingActor<TRegistryCollector>; 
-    public: 
+    };
+
+
+    class TRegistryCollector: public TProcStatCollectingActor<TRegistryCollector> {
+        using TBase = TProcStatCollectingActor<TRegistryCollector>;
+    public:
         TRegistryCollector(TDuration interval, NMonitoring::TMetricRegistry& registry)
-            : TBase{interval} 
-        { 
-            VmSize = registry.IntGauge({{"sensor", "process.VmSize"}}); 
-            AnonRssSize = registry.IntGauge({{"sensor", "process.AnonRssSize"}}); 
-            FileRssSize = registry.IntGauge({{"sensor", "process.FileRssSize"}}); 
+            : TBase{interval}
+        {
+            VmSize = registry.IntGauge({{"sensor", "process.VmSize"}});
+            AnonRssSize = registry.IntGauge({{"sensor", "process.AnonRssSize"}});
+            FileRssSize = registry.IntGauge({{"sensor", "process.FileRssSize"}});
             CGroupMemLimit = registry.IntGauge({{"sensor", "process.CGroupMemLimit"}});
             UptimeSeconds = registry.IntGauge({{"sensor", "process.UptimeSeconds"}});
             NumThreads = registry.IntGauge({{"sensor", "process.NumThreads"}});
@@ -251,12 +251,12 @@ namespace {
             SysTime = registry.Rate({{"sensor", "process.SystemTime"}});
             MinorPageFaults = registry.Rate({{"sensor", "process.MinorPageFaults"}});
             MajorPageFaults = registry.Rate({{"sensor", "process.MajorPageFaults"}});
-        } 
- 
-        void UpdateCounters(const TProcStat& procStat) { 
-            VmSize->Set(procStat.Vsize); 
-            AnonRssSize->Set(procStat.AnonRss); 
-            FileRssSize->Set(procStat.FileRss); 
+        }
+
+        void UpdateCounters(const TProcStat& procStat) {
+            VmSize->Set(procStat.Vsize);
+            AnonRssSize->Set(procStat.AnonRss);
+            FileRssSize->Set(procStat.FileRss);
             CGroupMemLimit->Set(procStat.CGroupMemLim);
             UptimeSeconds->Set(procStat.Uptime.Seconds());
             NumThreads->Set(procStat.NumThreads);
@@ -276,12 +276,12 @@ namespace {
 
             MajorPageFaults->Reset();
             MajorPageFaults->Add(procStat.MajFlt);
-        } 
- 
-    private: 
-        NMonitoring::TIntGauge* VmSize; 
-        NMonitoring::TIntGauge* AnonRssSize; 
-        NMonitoring::TIntGauge* FileRssSize; 
+        }
+
+    private:
+        NMonitoring::TIntGauge* VmSize;
+        NMonitoring::TIntGauge* AnonRssSize;
+        NMonitoring::TIntGauge* FileRssSize;
         NMonitoring::TIntGauge* CGroupMemLimit;
         NMonitoring::TRate* UserTime;
         NMonitoring::TRate* SysTime;
@@ -290,14 +290,14 @@ namespace {
         NMonitoring::TIntGauge* UptimeSeconds;
         NMonitoring::TIntGauge* NumThreads;
         NMonitoring::TIntGauge* SystemUptimeSeconds;
-    }; 
-} // namespace 
- 
+    };
+} // namespace
+
     IActor* CreateProcStatCollector(ui32 intervalSec, NMonitoring::TDynamicCounterPtr counters) {
         return new TDynamicCounterCollector(intervalSec, counters);
     }
 
     IActor* CreateProcStatCollector(TDuration interval, NMonitoring::TMetricRegistry& registry) {
-        return new TRegistryCollector(interval, registry); 
-    } 
+        return new TRegistryCollector(interval, registry);
+    }
 }

+ 3 - 3
library/cpp/actors/core/process_stats.h

@@ -5,10 +5,10 @@
 
 #include <library/cpp/monlib/dynamic_counters/counters.h>
 
-namespace NMonitoring { 
+namespace NMonitoring {
     class TMetricRegistry;
-} 
- 
+}
+
 namespace NActors {
     struct TProcStat {
         ui64 Rss;

+ 1 - 1
library/cpp/actors/core/ut/ya.make

@@ -38,7 +38,7 @@ SRCS(
     event_pb_ut.cpp
     executor_pool_basic_ut.cpp
     executor_pool_united_ut.cpp
-    log_ut.cpp 
+    log_ut.cpp
     memory_tracker_ut.cpp
     scheduler_actor_ut.cpp
 )

+ 2 - 2
library/cpp/actors/http/http_cache.cpp

@@ -1,6 +1,6 @@
 #include "http.h"
-#include "http_proxy.h" 
-#include "http_cache.h" 
+#include "http_proxy.h"
+#include "http_cache.h"
 #include <library/cpp/actors/core/actor_bootstrapped.h>
 #include <library/cpp/actors/core/executor_pool_basic.h>
 #include <library/cpp/actors/core/log.h>

+ 2 - 2
library/cpp/actors/http/http_static.cpp

@@ -1,5 +1,5 @@
-#include "http_proxy.h" 
-#include "http_static.h" 
+#include "http_proxy.h"
+#include "http_static.h"
 #include <library/cpp/actors/core/executor_pool_basic.h>
 #include <library/cpp/actors/core/log.h>
 #include <library/cpp/actors/core/scheduler_basic.h>

Some files were not shown because too many files changed in this diff