Skip to content

Commit

Permalink
Track gossipValidationError metrics by specific error code (#3888)
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion authored Apr 5, 2022
1 parent 3218989 commit 60fc678
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/lodestar/src/metrics/metrics/lodestar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ export function createLodestarMetrics(
help: "Count of total gossip validation reject",
labelNames: ["topic"],
}),
gossipValidationError: register.gauge<"topic" | "error">({
name: "lodestar_gossip_validation_error_total",
help: "Count of total gossip validation errors detailed",
labelNames: ["topic", "error"],
}),

gossipValidationQueueLength: register.gauge<"topic">({
name: "lodestar_gossip_validation_queue_length",
Expand Down
4 changes: 4 additions & 0 deletions packages/lodestar/src/network/gossip/validation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ function getGossipValidatorFn<K extends GossipType>(
const metadata = gossipObject && getGossipObjectAcceptMetadata(config, gossipObject, topic);
const errorData = {...metadata, ...e.getMetadata()};

// Metrics on specific error reason
// Note: LodestarError.code are bounded pre-declared error messages, not from arbitrary error.message
metrics?.gossipValidationError.inc({topic: type, error: (e as GossipActionError<{code: string}>).type.code});

switch (e.action) {
case GossipAction.IGNORE:
logger.debug(`gossip - ${type} - ignore`, errorData);
Expand Down

0 comments on commit 60fc678

Please sign in to comment.