Skip to content

Commit 15c0e8b

Browse files
authored
feat: track gossip attestation ignore/reject reasons (#7549)
1 parent e647fd7 commit 15c0e8b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

packages/beacon-node/src/metrics/metrics/lodestar.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {EpochTransitionStep, StateCloneSource, StateHashTreeRootSource} from "@l
22
import {BeaconState} from "@lodestar/types";
33
import {BlobsSource, BlockSource} from "../../chain/blocks/types.js";
44
import {JobQueueItemType} from "../../chain/bls/index.js";
5-
import {BlockErrorCode} from "../../chain/errors/index.js";
5+
import {AttestationErrorCode, BlockErrorCode} from "../../chain/errors/index.js";
66
import {InsertOutcome} from "../../chain/opPools/types.js";
77
import {RegenCaller, RegenFnName} from "../../chain/regen/interface.js";
88
import {ReprocessStatus} from "../../chain/reprocess.js";
@@ -116,6 +116,16 @@ export function createLodestarMetrics(
116116
help: "Count of total gossip validation errors detailed",
117117
labelNames: ["topic", "error"],
118118
}),
119+
gossipAttestationIgnoreByReason: register.gauge<{reason: AttestationErrorCode}>({
120+
name: "lodestar_gossip_attestation_ignore_by_reason_total",
121+
help: "Count of total gossip attestation ignore by reason",
122+
labelNames: ["reason"],
123+
}),
124+
gossipAttestationRejectByReason: register.gauge<{reason: AttestationErrorCode}>({
125+
name: "lodestar_gossip_attestation_reject_by_reason_total",
126+
help: "Count of total gossip attestation reject by reason",
127+
labelNames: ["reason"],
128+
}),
119129
executeWorkCalls: register.gauge({
120130
name: "lodestar_network_processor_execute_work_calls_total",
121131
help: "Total calls to network processor execute work fn",

packages/beacon-node/src/network/processor/gossipValidatorFn.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,13 @@ export function getGossipValidatorBatchFn(
6060
switch (e.action) {
6161
case GossipAction.IGNORE:
6262
metrics?.networkProcessor.gossipValidationIgnore.inc({topic: type});
63+
// only beacon_attestation topic is validated in batch
64+
metrics?.networkProcessor.gossipAttestationIgnoreByReason.inc({reason: e.type.code});
6365
return TopicValidatorResult.Ignore;
64-
6566
case GossipAction.REJECT:
6667
metrics?.networkProcessor.gossipValidationReject.inc({topic: type});
68+
// only beacon_attestation topic is validated in batch
69+
metrics?.networkProcessor.gossipAttestationRejectByReason.inc({reason: e.type.code});
6770
logger.debug(`Gossip validation ${type} rejected`, {}, e);
6871
return TopicValidatorResult.Reject;
6972
}

0 commit comments

Comments
 (0)