diff --git a/src/blockchain/fork_choice.cpp b/src/blockchain/fork_choice.cpp index 3d79548..46a1c5b 100644 --- a/src/blockchain/fork_choice.cpp +++ b/src/blockchain/fork_choice.cpp @@ -311,10 +311,11 @@ namespace lean { outcome::result ForkChoiceStore::onAttestation( const SignedAttestation &signed_attestation, bool is_from_block) { // First, ensure the attestation is structurally and temporally valid. + auto source = is_from_block ? "block" : "gossip"; if (auto res = validateAttestation(signed_attestation); res.has_value()) { - metrics_->fc_attestations_valid_total()->inc(); + metrics_->fc_attestations_valid_total({{"source", source}})->inc(); } else { - metrics_->fc_attestations_invalid_total()->inc(); + metrics_->fc_attestations_invalid_total({{"source", source}})->inc(); return res; } diff --git a/src/blockchain/fork_choice_metrics.def b/src/blockchain/fork_choice_metrics.def index b46555d..31bab14 100644 --- a/src/blockchain/fork_choice_metrics.def +++ b/src/blockchain/fork_choice_metrics.def @@ -41,12 +41,14 @@ METRIC_GAUGE(fc_head_slot, "lean_head_slot", "Latest slot of the beacon chain") // Attestation validation -METRIC_COUNTER(fc_attestations_valid_total, - "lean_attestations_valid_total", - "Total number of valid attestations") -METRIC_COUNTER(fc_attestations_invalid_total, - "lean_attestations_invalid_total", - "Total number of invalid attestations") +METRIC_COUNTER_LABELS(fc_attestations_valid_total, + "lean_attestations_valid_total", + "Total number of valid attestations", + {"source"}) +METRIC_COUNTER_LABELS(fc_attestations_invalid_total, + "lean_attestations_invalid_total", + "Total number of invalid attestations", + {"source"}) METRIC_HISTOGRAM(fc_attestation_validation_time_seconds, "lean_attestation_validation_time_seconds", "Time taken to validate attestation",