feat: add attestation production time metric#30
Merged
KatyaRyazantseva merged 1 commit intoleanEthereum:mainfrom Apr 19, 2026
Merged
Conversation
This was referenced Apr 19, 2026
Open
MegaRedHand
pushed a commit
to lambdaclass/ethlambda
that referenced
this pull request
Apr 21, 2026
… PR #30 (#312) ## Motivation Implements the `lean_attestations_production_time_seconds` histogram defined in [leanEthereum/leanMetrics#30](leanEthereum/leanMetrics#30), which measures the end-to-end time a node spends producing attestations for all its validators in a given slot. ## Description ### New Metric | Metric | Type | Buckets | Sample collection event | |--------|------|---------|-------------------------| | `lean_attestations_production_time_seconds` | Histogram | 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 0.75, 1 | On attestation production | ### Implementation - **`crates/blockchain/src/metrics.rs`**: registers the histogram under the `Validator Metrics` family and exposes `time_attestations_production()`, which returns a `TimingGuard` that observes the duration on drop. Added to the `init()` eager-registration list so the metric appears on `/metrics` from process start. - **`crates/blockchain/src/lib.rs`**: instruments `produce_attestations()` with `let _timing = metrics::time_attestations_production();` at the top of the function, capturing the full flow: 1. Attestation data construction (`store::produce_attestation_data`) 2. Per-validator signing 3. Self-delivery via `on_gossip_attestation` 4. Gossip publish ### Documentation - **`docs/metrics.md`**: adds a `Buckets` column to the Validator Metrics table (consistent with the other tables in the doc) and lists the new metric alongside `lean_validators_count` and `lean_is_aggregator`. ## How to Test 1. `make fmt` - passes 2. `make lint` - passes (clippy clean) 3. `make test` - passes 4. Run a local devnet and verify the metric appears on the `/metrics` endpoint (port 5054): ``` curl -s localhost:5054/metrics | grep lean_attestations_production_time_seconds ``` You should see the histogram buckets populate as the node produces attestations each slot. ## Related - leanMetrics spec: leanEthereum/leanMetrics#30 - Previous metrics PR: #289 (Devnet-4 metrics from leanMetrics PR #29)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
lean_attestations_production_time_secondshistogram to Validator Metrics.