-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'No sync target' logging improvements #4853
'No sync target' logging improvements #4853
Conversation
...eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncTargetManager.java
Outdated
Show resolved
Hide resolved
"No sync target, checking current peers for usefulness: {}", | ||
ethContext.getEthPeers().peerCount()); | ||
if (maybeBestPeer.isEmpty()) { | ||
if (shouldLogDebug.compareAndSet(true, false)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know log throttling is done in at least one other place:
Lines 287 to 296 in 7d5988d
private void logForkchoiceUpdatedCall( | |
final BiConsumer<EngineStatus, EngineForkchoiceUpdatedParameter> logAtLevel, | |
final EngineStatus status, | |
final EngineForkchoiceUpdatedParameter forkChoice) { | |
// cheaply limit the noise of fcU during consensus client syncing to once a minute: | |
if (lastFcuInfoLog + ENGINE_API_LOGGING_THRESHOLD < System.currentTimeMillis()) { | |
lastFcuInfoLog = System.currentTimeMillis(); | |
logAtLevel.accept(status, forkChoice); | |
} | |
} |
Would be good to have a single way to do it in a logging util. I can think of several places we could use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has the usage of a BurstFilter been analyzed for this use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @fab-10 may have looked into that or some similar feature of log4j. I agree that would be a neater approach and can't see a reason why we wouldn't want to use it for all logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't yet looked at how to throttle this kind of logs, what I did was about summarizing the progress of the sync every tot seconds, this seems different, and I agree that something like the BurstFilter make sense here, since it could also be easily configurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my investigation, BurstFilter doesn't appear to be specific enough to address this use case. My understanding is that it throttles the entire log level, whereas this functionality allows a specific (potentially spammy) log message to be throttled. Is my understanding of BurstFilter correct, or is it able to be targeted to a class/method level?
A logging improvement via log4j configuration would likely also require the user to configure it.
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/util/LogUtil.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change request to avoid creating a thread on very log call. But if possible evaluate the usage of a BurstFilter for throttling logs
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/util/LogUtil.java
Outdated
Show resolved
Hide resolved
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/util/LogUtil.java
Outdated
Show resolved
Hide resolved
Will review BurstFilter. 👍 |
Signed-off-by: mark-terry <mark.terry@consensys.net>
Signed-off-by: mark-terry <mark.terry@consensys.net>
874cfd8
to
57ec20f
Compare
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/util/LogUtil.java
Outdated
Show resolved
Hide resolved
Signed-off-by: mark-terry <mark.terry@consensys.net>
Signed-off-by: mark-terry <mark.terry@consensys.net>
Signed-off-by: mark-terry <mark.terry@consensys.net>
Signed-off-by: mark-terry mark.terry@consensys.net
PR description
"No sync target, checking current peers for usefulness" logging made less spammy, with improved detail.
Fixed Issue(s)
Addresses #4794
Documentation
doc-change-required
label to this PR ifupdates are required.
Changelog