Skip to content

Commit

Permalink
Misc logging cleans up (Consensys#172)
Browse files Browse the repository at this point in the history
* Remove excessive logging
* Fix minor issue with adding a new connected peer in DataColumnPeerManagerImpl
* Reduce log exceptions noise in case of invalid ENR Eth2 field encoding
* A bit more verbose logging for PeerManager
  • Loading branch information
Nashatyrev authored Oct 21, 2024
1 parent 40e2769 commit 874ba2f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.units.bigints.UInt256;
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.infrastructure.async.stream.AsyncStream;
Expand All @@ -30,8 +28,6 @@
import tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.DataColumnIdentifier;

public class DataColumnReqRespBatchingImpl implements DataColumnReqResp {
private static final Logger LOG = LogManager.getLogger("das-nyota");

private final BatchDataColumnsByRootReqResp batchRpc;

public DataColumnReqRespBatchingImpl(BatchDataColumnsByRootReqResp batchRpc) {
Expand Down Expand Up @@ -67,11 +63,6 @@ public void flush() {
}

private void flushForNode(UInt256 nodeId, List<RequestEntry> nodeRequests) {
LOG.info(
"[nyota] Requesting batch of {} from {}, hash={}",
nodeRequests.size(),
"0x..." + nodeId.toHexString().substring(58),
nodeRequests.hashCode());
AsyncStream<DataColumnSidecar> response =
batchRpc.requestDataColumnSidecarsByRoot(
nodeId, nodeRequests.stream().map(e -> e.columnIdentifier).toList());
Expand Down Expand Up @@ -100,11 +91,6 @@ public SafeFuture<Boolean> onNext(DataColumnSidecar dataColumnSidecar) {

@Override
public void onComplete() {
LOG.info(
"[nyota] Response batch of {} from {}, hash={}",
count,
"0x..." + nodeId.toHexString().substring(58),
nodeRequests.hashCode());
nodeRequests.stream()
.filter(req -> !req.promise().isDone())
.forEach(
Expand All @@ -114,15 +100,7 @@ public void onComplete() {

@Override
public void onError(Throwable err) {
nodeRequests.forEach(
e -> {
LOG.info(
"[nyota] Error batch from {}, hash={}, err: {}",
"0x..." + nodeId.toHexString().substring(58),
nodeRequests.hashCode(),
e.toString());
e.promise().completeExceptionally(err);
});
nodeRequests.forEach(e -> e.promise().completeExceptionally(err));
}
});
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public SimpleSidecarRetriever(
this.custodyCountSupplier = custodyCountSupplier;
this.asyncRunner = asyncRunner;
this.roundPeriod = roundPeriod;
this.reqResp = new DataColumnReqRespImpl(peerManager, reqResp);
this.reqResp = reqResp;
peerManager.addPeerListener(this);
this.maxRequestCount =
SpecConfigEip7594.required(spec.forMilestone(SpecMilestone.EIP7594).getConfig())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public void onConnected(Eth2Peer peer) {

private void peerConnected(Eth2Peer peer) {
UInt256 nodeId = peer.getDiscoveryNodeId().orElseThrow();
listeners.forEach(l -> l.peerConnected(nodeId));
connectedPeers.put(nodeId, peer);
listeners.forEach(l -> l.peerConnected(nodeId));
peer.subscribeDisconnect((__, ___) -> peerDisconnected(peer));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private static <T> Optional<T> parseField(
try {
return Optional.ofNullable((Bytes) nodeRecord.get(fieldName)).map(parse);
} catch (final Exception e) {
LOG.debug("Failed to parse ENR field {}", fieldName, e);
LOG.debug("Failed to parse ENR field {}: {}", fieldName, e);
return Optional.empty();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public Multiaddr getMultiaddr() {
return multiaddr;
}

@Override
public String toString() {
return getId() + " (" + getMultiaddr() + ")";
}

@Override
public boolean equals(final Object o) {
if (this == o) {
Expand Down

0 comments on commit 874ba2f

Please sign in to comment.