feat(maintainer): record SPV proof-submission metrics - #4190
Open
piotr-roslaniec wants to merge 3 commits into
Open
feat(maintainer): record SPV proof-submission metrics#4190piotr-roslaniec wants to merge 3 commits into
piotr-roslaniec wants to merge 3 commits into
Conversation
The SPV proof submitters accept an optional metrics recorder, but the maintainer command never built one, so proof-submission counters were never recorded in production (the recorder was always passed as nil). Wire a clientinfo registry and PerformanceMetrics into the maintainer boot path and thread the recorder through maintainer.Initialize into the SPV maintainer, replacing the hardcoded nil at the deposit sweep and redemption submitters. Add ClientInfo to the maintainer config categories so the metrics endpoint port is parsed. Moving funds and moved funds sweep submitters accept the recorder to satisfy the submitter type but are not yet instrumented, as those proof submissions have no metrics counters defined.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ilure Close review gaps on the SPV proof-submission metrics change: - assert the redemption success-path counters; the success test previously passed a nil recorder and asserted nothing, so a removed/misplaced success increment would go undetected. - cover the assemble-error failed-counter branch for both the deposit sweep and redemption provers (a realistic production failure mode); only the early zero-confirmations reject was asserted before. The on-chain-submit branch shares the same guard idiom but the local chain double cannot be forced to fail that call. - add a cmd test for initializeMaintainerMetrics: a 0 client-info port yields a nil recorder, guarding the sole production metrics on/off gate against an inverted condition.
…ntract - list the six SPV proof-submission counters in performance-metrics.adoc; this change is what makes them observable in production. - reframe the MetricsRecorder doc as an API contract (callers must treat nil as "metrics off" and guard every call) instead of the rot-prone "all call sites guard against it" status claim.
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.
What
Wires a
clientinfometrics registry +PerformanceMetricsinto themaintainercommand and threads a real metrics recorder throughmaintainer.Initializeinto the SPV maintainer, so deposit-sweep and redemption proof-submission counters are actually recorded in production.Why
The SPV proof submitters accept an optional metrics recorder, but the maintainer boot path never built one, so the recorder was always
niland the counters were dead in production.maintaineris the only command that runs the SPV maintainer, so these metrics were never observable.Changes
cmd/maintainer.go: build the client-info registry +PerformanceMetrics(newinitializeMaintainerMetricshelper), register baseline client-info + Ethereum sources, and pass the recorder tomaintainer.Initialize. The recorder is derived from the client-info registry: whenclientInfo.port=0,clientinfo.Initializereports not-configured and the recorder stays a genuinenilinterface (no typed-nil trap), disabling metrics recording.config/category.go: addClientInfotoMaintainerCategoriesso the client-info port is parsed for the maintainer command. BecauseclientInfo.portdefaults to9601(the same shared flag the nodestartcommand uses), the maintainer now serves the client-info metrics/diagnostics endpoint on:9601by default, consistent withstart. Operators who do not want the endpoint can setclientInfo.port=0. See the operator impact note below.pkg/maintainer/maintainer.go: threadspv.MetricsRecorderthroughInitializeintospv.Initialize.pkg/maintainer/spv: add an exportedMetricsRecorderinterface; store it onspvMaintainer; extend thetransactionProofSubmittertype; forward the recorder (instead of hardcodednil) at the deposit-sweep and redemption submitters. Moving-funds and moved-funds-sweep submitters accept the recorder to satisfy the type but are not yet instrumented (no counters defined for them).cmd/maintainercli.go: the two manual one-off proof-submit subcommands passnil(no registry in that path).docs/performance-metrics.adoc: document the six SPV proof-submission counters that this change makes observable in production.Release note / operator impact
The
maintainercommand now exposes the client-info metrics/diagnostics HTTP endpoint on port9601(all interfaces) by default, matching the behavior of the nodestartcommand. The endpoint serves system/process metrics, client version, Ethereum connectivity/latest-block info, and the SPV proof-submission counters. It does not expose the Ethereum operator key or peer/operator identity. Operators who do not want the maintainer to open this endpoint should setclientInfo.port=0in theClientInfoconfig section (or via--clientInfo.port=0).Tests
TestSubmitDepositSweepProofandTestSubmitRedemptionProofthread a real recorder and assert the attempt/success/failure counters fire on the success path.TestSubmitDepositSweepProofRecordsFailureMetrics/TestSubmitRedemptionProofRecordsFailureMetricscover the attempt+failure counters on the early zero-confirmations reject path.TestSubmitDepositSweepProofRecordsAssembleFailureMetrics/TestSubmitRedemptionProofRecordsAssembleFailureMetricscover the failed-counter increment on the SPV-proof-assembly error branch.TestInitializeMaintainerMetricsDisabledWhenPortUnsetguards the metrics on/off gate: a0client-info port yields a nil recorder.Base / stacking
Based on
chore/code-quality-followups(#4187), notmain: the param-based recorder seam this PR fills only exists after that PR removed the global metrics singleton. Once #4187 merges, this branch should be rebased--onto mainand becomes a standalone change.