diff options
author | snaury <snaury@ydb.tech> | 2022-09-13 16:31:39 +0300 |
---|---|---|
committer | snaury <snaury@ydb.tech> | 2022-09-13 16:31:39 +0300 |
commit | 6d0f751258635daa9925e5dadb453b8fd8f83635 (patch) | |
tree | 877f6981575d43965537a43ab3e1467e82b7da9b | |
parent | 7a6811338c33ec8523f9ecc907765ce343a3ef04 (diff) | |
download | ydb-6d0f751258635daa9925e5dadb453b8fd8f83635.tar.gz |
Remove Sleep from logger when AllowDrop is false
-rw-r--r-- | library/cpp/actors/core/log.cpp | 16 | ||||
-rw-r--r-- | library/cpp/actors/core/log.h | 1 |
2 files changed, 3 insertions, 14 deletions
diff --git a/library/cpp/actors/core/log.cpp b/library/cpp/actors/core/log.cpp index eb8b19193c..24fdcf1d92 100644 --- a/library/cpp/actors/core/log.cpp +++ b/library/cpp/actors/core/log.cpp @@ -30,8 +30,6 @@ namespace { } namespace NActors { - TAtomic TLoggerActor::IsOverflow = 0; - TLoggerActor::TLoggerActor(TIntrusivePtr<NLog::TSettings> settings, TAutoPtr<TLogBackend> logBackend, TIntrusivePtr<NMonitoring::TDynamicCounters> counters) @@ -94,8 +92,9 @@ namespace NActors { } void TLoggerActor::Throttle(const NLog::TSettings& settings) { - if (AtomicGet(IsOverflow)) - Sleep(settings.ThrottleDelay); + // throttling via Sleep was removed since it causes unexpected + // incidents when users try to set AllowDrop=false. + Y_UNUSED(settings); } void TLoggerActor::LogIgnoredCount(TInstant now) { @@ -179,9 +178,6 @@ namespace NActors { i64 delayMillisec = (ctx.Now() - ev->Get()->Stamp).MilliSeconds(); WriteMessageStat(*ev->Get()); if (Settings->AllowDrop) { - // Disable throttling if it was enabled previously - if (AtomicGet(IsOverflow)) - AtomicSet(IsOverflow, 0); if (PassedCount > 10 && delayMillisec > (i64)Settings->TimeThresholdMs || IgnoredCount > 0 || !LogBuffer.IsEmpty()) { TLogBufferMessage lbm(ev); if (!TryKeepLog(lbm, ctx)) { @@ -195,12 +191,6 @@ namespace NActors { return; } PassedCount++; - } else { - // Enable of disable throttling depending on the load - if (delayMillisec > (i64)Settings->TimeThresholdMs && !AtomicGet(IsOverflow)) - AtomicSet(IsOverflow, 1); - else if (delayMillisec <= (i64)Settings->TimeThresholdMs && AtomicGet(IsOverflow)) - AtomicSet(IsOverflow, 0); } if (!OutputRecord(ev->Get()->Stamp, ev->Get()->Level.ToPrio(), ev->Get()->Component, ev->Get()->Line)) { diff --git a/library/cpp/actors/core/log.h b/library/cpp/actors/core/log.h index 7c6921bca7..947f8a35b5 100644 --- a/library/cpp/actors/core/log.h +++ b/library/cpp/actors/core/log.h @@ -231,7 +231,6 @@ namespace NActors { std::shared_ptr<TLogBackend> LogBackend; ui64 IgnoredCount = 0; ui64 PassedCount = 0; - static TAtomic IsOverflow; TDuration WakeupInterval{TDuration::Seconds(5)}; std::unique_ptr<ILoggerMetrics> Metrics; TLogBuffer LogBuffer; |