Skip to content

Commit

Permalink
feat: track attestationInBlockParticipants (#5749)
Browse files Browse the repository at this point in the history
Track attestationInBlockParticipants
  • Loading branch information
dapplion authored Jul 12, 2023
1 parent 7e34c46 commit cf659f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/beacon-node/src/metrics/metrics/lodestar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,11 @@ export function createLodestarMetrics(
help: "The excess slots (beyond the minimum delay) between the attestation slot and the block slot",
buckets: [0.1, 0.25, 0.5, 1, 2, 5, 10],
}),
attestationInBlockParticipants: register.histogram({
name: "validator_monitor_attestation_in_block_participants",
help: "The total participants in attestations of monitored validators included in blocks",
buckets: [1, 5, 20, 50, 100, 200],
}),
syncSignatureInAggregateTotal: register.gauge({
name: "validator_monitor_sync_signature_in_aggregate_total",
help: "Number of times a sync signature has been seen in an aggregate",
Expand Down
3 changes: 3 additions & 0 deletions packages/beacon-node/src/metrics/validatorMonitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,12 +529,14 @@ export function createValidatorMonitor(
const inclusionDistance = Math.max(parentSlot - data.slot, 0) + 1;
const delay = inclusionDistance - MIN_ATTESTATION_INCLUSION_DELAY;
const epoch = computeEpochAtSlot(data.slot);
const participants = indexedAttestation.attestingIndices.length;

for (const index of indexedAttestation.attestingIndices) {
const validator = validators.get(index);
if (validator) {
metrics.validatorMonitor.attestationInBlockTotal.inc();
metrics.validatorMonitor.attestationInBlockDelaySlots.observe(delay);
metrics.validatorMonitor.attestationInBlockParticipants.observe(participants);

const summary = getEpochSummary(validator, epoch);
summary.attestationBlockInclusions += 1;
Expand Down Expand Up @@ -566,6 +568,7 @@ export function createValidatorMonitor(
committeeIndex: data.index,
inclusionDistance,
correctHead,
participants,
});
}
}
Expand Down

0 comments on commit cf659f4

Please sign in to comment.