mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-09 15:48:08 -05:00
feat: log agent, version and peerid for batched gossip errors (#8604)
**Motivation** Logs client meta for batch processed gossip errors
This commit is contained in:
@@ -46,13 +46,19 @@ export function getGossipValidatorBatchFn(
|
||||
}))
|
||||
);
|
||||
|
||||
return results.map((e) => {
|
||||
return results.map((e, i) => {
|
||||
if (e == null) {
|
||||
return TopicValidatorResult.Accept;
|
||||
}
|
||||
|
||||
const {clientAgent, clientVersion, propagationSource} = messageInfos[i];
|
||||
|
||||
if (!(e instanceof AttestationError)) {
|
||||
logger.debug(`Gossip batch validation ${type} threw a non-AttestationError`, {}, e as Error);
|
||||
logger.debug(
|
||||
`Gossip batch validation ${type} threw a non-AttestationError`,
|
||||
{peerId: prettyPrintPeerIdStr(propagationSource), clientAgent, clientVersion},
|
||||
e as Error
|
||||
);
|
||||
metrics?.networkProcessor.gossipValidationIgnore.inc({topic: type});
|
||||
return TopicValidatorResult.Ignore;
|
||||
}
|
||||
@@ -67,7 +73,11 @@ export function getGossipValidatorBatchFn(
|
||||
metrics?.networkProcessor.gossipValidationReject.inc({topic: type});
|
||||
// only beacon_attestation topic is validated in batch
|
||||
metrics?.networkProcessor.gossipAttestationRejectByReason.inc({reason: e.type.code});
|
||||
logger.debug(`Gossip validation ${type} rejected`, {}, e);
|
||||
logger.debug(
|
||||
`Gossip validation ${type} rejected`,
|
||||
{peerId: prettyPrintPeerIdStr(propagationSource), clientAgent, clientVersion},
|
||||
e
|
||||
);
|
||||
return TopicValidatorResult.Reject;
|
||||
}
|
||||
});
|
||||
@@ -125,7 +135,11 @@ export function getGossipValidatorFn(gossipHandlers: GossipHandlers, modules: Va
|
||||
} catch (e) {
|
||||
if (!(e instanceof GossipActionError)) {
|
||||
// not deserve to log error here, it looks too dangerous to users
|
||||
logger.debug(`Gossip validation ${type} threw a non-GossipActionError`, {}, e as Error);
|
||||
logger.debug(
|
||||
`Gossip validation ${type} threw a non-GossipActionError`,
|
||||
{peerId: prettyPrintPeerIdStr(propagationSource), clientAgent, clientVersion},
|
||||
e as Error
|
||||
);
|
||||
return TopicValidatorResult.Ignore;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user