Skip to content

Metrics registration can panic at startup #78

@qj0r9j0vc2

Description

@qj0r9j0vc2

Problem

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

Details

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions