Repository navigation
feat(pq): expose aggregation timings as Prometheus metrics - #941
Open
pablodeymo wants to merge 1 commit into
Open
pablodeymo wants to merge 1 commit into
pablodeymo wants to merge 1 commit into
Conversation
pq-devnet-1 asks every client for its aggregation timings (committee proof, recursive merge, aggregate arrival). The node measured the first two but only wrote them to the log, and nothing recorded where in the slot a vote arrived, so a dashboard had nothing to plot for ethlambda. Step 1 of #938. On /metrics, all lazily registered, so a network without PQ shows none: - Committee proofs, by aggregator seat (rpc's seat prover): leanVM's proving time, how far into the slot the proof was ready, its signatures and size, and lean_beacon_pq_committee_proofs_total by outcome (proved, late, failed, already_proven, unproved). - Block-proof merges, by phase (ahead of the slot, at production): duration, children and merged size when the merge ends, in time or not, and lean_beacon_pq_merges_total by outcome (merged, failed, late, skipped). - lean_beacon_pq_proof_verification_seconds, by kind: an aggregate's proof in the gossip rules, a block's merged proof in process_stark. - lean_beacon_pq_gossip_arrival_offset_seconds, by topic kind: every attestation and aggregate that decodes, from the start of its own slot. No behaviour changes: prove_committee returns a Duration where it returned milliseconds, and the packing's fall_back closure takes the merge outcome it counts. ethlambda_metrics::series_value reads one series from the default registry by its exposition name, for the tests that check a path left its metrics behind.
3 of 5 tasks
This branch has not been deployed
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.
🗒️ Description / Motivation
pq-devnet-1 asks every client to expose its aggregation timings: committee proof, recursive merge and aggregate arrival (notes, "Client requirements", Timings), and ethPandaOps asked for them again during the run. ethlambda measured the first two but only wrote them to the log, and nothing recorded where in the slot a vote arrived. A dashboard had nothing to plot for ethlambda, and comparing it with another client meant scraping logs.
This is step 1 of #938: Prometheus metrics on the node. Steps 2 and 3 (the
--pq-timing-outputexport the other clients share, and the observer mode) are not in this PR.What Changed
Eleven series on the node's
/metrics, each defined in the crate that measures it. All are registered on first use, so a network that does not schedule PQ shows none of them.lean_beacon_pq_committee_proof_secondspositionlean_beacon_pq_committee_proof_ready_offset_secondspositionlean_beacon_pq_committee_proof_signatureslean_beacon_pq_committee_proof_size_byteslean_beacon_pq_committee_proofs_totalposition,outcomeproved,late,failed,already_proven,unprovedlean_beacon_pq_merge_secondsphaselean_beacon_pq_merge_childrenlean_beacon_pq_merged_proof_size_byteslean_beacon_pq_merges_totalphase,outcomemerged,failed,late,skippedlean_beacon_pq_proof_verification_secondskindaggregate's proof or oneblock's merged prooflean_beacon_pq_gossip_arrival_offset_secondskindBy area:
crates/net/rpc/src/beacon/pq_aggregation.rs,crates/net/rpc/src/metrics.rs).prove_seatobserves every proof it makes, late ones included, under the aggregator seat'sposition, and counts the seat's committees by outcome once its pass ends. These are the numbers theFinished proving this seat's PQ aggregateslog line already carried.crates/blockchain/src/pq_attestation_packing.rs,crates/blockchain/src/metrics.rs).pack_attestationsobserves a merge when it ends, in time or not, underphase:aheadfor the packing started ahead of the slot,productionfor one block production runs itself. The outcome counter is incremented where the packing already decided between the merged proof and the one-committee fallback.crates/blockchain/state_transition/src/beacon/gossip/pq.rs,stf/pq.rs,metrics.rs). Timesstark.VerifyAggregatesat its two call sites: an aggregate's proof in the gossip rules (gossip, and a validator client's own aggregates through the Beacon API), and a block's merged proof inprocess_stark. A block without attestations is not a sample.crates/net/p2p/src/beacon/pq.rs,crates/net/p2p/src/metrics.rs).triageobserves every PQ attestation and aggregate that decodes, from the start of the vote's own slot, at the instant gossipsub delivered it. Thekindvalues are the oneslean_beacon_gossip_validation_secondsuses (beacon_attestation,beacon_aggregate_and_proof).docs/metrics.mdwith the table, the buckets and how to read each group, and a pointer fromdocs/beacon_pq.md.ethlambda_metrics::series_valuereads one series from the default registry by its exposition name.Differences from the names #938 suggested
phase, notround: ethlambda's two merges are "ahead of the slot" and "at production", not two rounds of one job.lean_beacon_pq_proof_verification_seconds{kind}rather thanlean_beacon_pq_aggregate_verify_seconds, so it also covers a block's merged proof, which nothing timed before (process_starkis outside the STF phases).lean_beacon_pq_merges_totalis new. The duration alone cannot show a merge that missed its budget and left the block with one committee's attestation.Correctness / Behavior Guarantees
prove_committeereturns aDurationwhere it returned milliseconds, and the packing'sfall_backclosure takes the merge outcome it counts. Whether a proof is on time is decided before its metrics are recorded, as before.positionis 0 to 3, the rest are fixed strings.Things a reader of the dashboards should know:
committee_proof_secondsincludes any wait for a merge or another proof already running.No time left to prove this seat's PQ aggregates. Its committees are not counted asunproved, because counting them needs the head state that path does not read.Tests Added / Run
Added, each checked to fail when its metric call is removed:
a_seats_proving_pass_is_timed_and_counted(rpc): drivesprove_seatfor seats 0 and 1 on a PQ state with collected signatures. Seat 0 proves one committee:provedis 1, the proof is timed once, ready between 5.0 and 7.2 s into the slot, with the committee's signature count. Seat 1 finds italready_provenand times nothing.a_merge_with_no_time_left_is_counted_as_skipped_by_phase(blockchain): two aggregates to merge and a slot long past, under both phases.a_decoded_votes_arrival_is_recorded_under_its_topic_kindanda_votes_arrival_is_measured_from_its_own_slot(p2p): one sample per decoded attestation and aggregate, none for a slashing or an undecodable message; the offset is from the vote's own slot and zero for a vote ahead of it.process_stark_checks_the_attesters_signaturesanda_pq_aggregate_needs_an_aggregator_its_signature_and_its_proof(state transition) now also assert their verifications were timed, the refused proofs' too.a_series_is_read_by_its_exposition_name(metrics): the helper.Not covered by a test:
merged,failedandlateoutcomes. A test that runs a real merge takes the global merge permit, andan_abandoned_packing_does_not_take_the_merge_permitasserts that permit is free, so the two would race.Run on the final tree:
make lintclean;make test4,204 passed, 0 failed, 97 ignored.Related Issues / PRs
pq-devnet-1(feat(pq): pq-devnet-1 — leanVM bindings v0.19.0 in process, consensus-specs pq at 4c296784 #896)✅ Verification Checklist
make fmt— cleanmake lint(clippy with-D warnings) — cleanmake test(test-consensusplustest-node, atrelease-fast) — all passing