You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SyncEngineMetrics (src/metrics.rs) is just a bag of AtomicUsize fields with no way to read them together as a consistent snapshot, no way to reset them (e.g. for periodic reporting windows), and no export format. An embedding wallet or relay node has no way to surface "how many payments are queued right now," "how many conflicts have been detected this week," etc. to a dashboard, a support ticket, or a telemetry pipeline — all of which matter for an org running a "Relay Node Monitoring Dashboard" per the top-level roadmap.
Requirements
Implement pub fn snapshot(&self) -> MetricsSnapshot, a plain-data struct capturing every counter's current value atomically-enough for reporting purposes (perfect cross-field atomicity isn't required — document that this is an approximate, independently-read snapshot, not a transactionally consistent one).
Implement a Prometheus text-exposition-format serializer (pub fn to_prometheus_text(&self) -> String) — this is a well-specified, simple text format; look up the spec rather than inventing your own.
Add whatever additional counters are missing but implied by other issues in this backlog (e.g. queue_evictions from issue Bound OutboundTxQueue Capacity with Priority-Aware Eviction #5, conflicts_detected/disputes_escalated are already present — audit SyncEngineMetrics for gaps against every module in src/ and fill them in).
Consider a reset/windowed-counting mode (e.g. snapshot_and_reset()) for callers who want periodic deltas rather than lifetime totals, and document when each is appropriate.
Acceptance Criteria
snapshot() returns accurate values matching the underlying atomics at call time.
to_prometheus_text() output is valid Prometheus exposition format (verify against the spec, e.g. correct # TYPE/# HELP lines and metric naming conventions).
Every counter that exists anywhere in this crate (including ones added by other landed issues) is represented in the snapshot — audit for completeness.
cargo fmt, cargo clippy -D warnings, and cargo test all pass.
Required Tests
test_snapshot_reflects_current_values
test_prometheus_output_is_well_formed
test_snapshot_and_reset_zeroes_counters
Notes
Independent of all other issues — purely additive to src/metrics.rs.
Estimated effort: small-medium. Good pickup for a contributor newer to Rust who still wants a genuinely useful, non-trivial task.
Implement a Metrics Snapshot/Export API
Labels:
hardobservabilityOfficial CampaignMaybe RewardedComponent:
src/metrics.rsProblem
SyncEngineMetrics(src/metrics.rs) is just a bag ofAtomicUsizefields with no way to read them together as a consistent snapshot, no way to reset them (e.g. for periodic reporting windows), and no export format. An embedding wallet or relay node has no way to surface "how many payments are queued right now," "how many conflicts have been detected this week," etc. to a dashboard, a support ticket, or a telemetry pipeline — all of which matter for an org running a "Relay Node Monitoring Dashboard" per the top-level roadmap.Requirements
pub fn snapshot(&self) -> MetricsSnapshot, a plain-data struct capturing every counter's current value atomically-enough for reporting purposes (perfect cross-field atomicity isn't required — document that this is an approximate, independently-read snapshot, not a transactionally consistent one).pub fn to_prometheus_text(&self) -> String) — this is a well-specified, simple text format; look up the spec rather than inventing your own.queue_evictionsfrom issue BoundOutboundTxQueueCapacity with Priority-Aware Eviction #5,conflicts_detected/disputes_escalatedare already present — auditSyncEngineMetricsfor gaps against every module insrc/and fill them in).snapshot_and_reset()) for callers who want periodic deltas rather than lifetime totals, and document when each is appropriate.Acceptance Criteria
snapshot()returns accurate values matching the underlying atomics at call time.to_prometheus_text()output is valid Prometheus exposition format (verify against the spec, e.g. correct# TYPE/# HELPlines and metric naming conventions).cargo fmt,cargo clippy -D warnings, andcargo testall pass.Required Tests
test_snapshot_reflects_current_valuestest_prometheus_output_is_well_formedtest_snapshot_and_reset_zeroes_countersNotes
src/metrics.rs.