decipherhub / decipherhub/cipherbft

Metrics registration can panic at startup

Open
#78 0 comments 0 reactions 1 assignee Claimed by @qj0r9j0vc2 View on GitHub
bug reliability
Dominant language
Rust
Stars
9
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## Problem

RPC metrics in `crates/rpc/src/metrics.rs` use `expect()` during lazy static initialization, which will panic if metric registration fails.

## Details

```rust
static ref RPC_REQUESTS_TOTAL: IntCounterVec = IntCounterVec::new(...)
.expect("Failed to register rpc_requests_total metric")
```

All metric registrations follow this pattern:
- `RPC_REQUESTS_TOTAL`
- `RPC_REQUEST_DURATION`
- `RPC_ACTIVE_CONNECTIONS`
- `RPC_WS_SUBSCRIPTIONS`
- `RPC_RATE_LIMIT_REJECTIONS`

## Impact

- If Prometheus registry has naming conflicts or is exhausted, node crashes at startup
- No graceful degradation to running without metrics

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.