Skip to content

[MET-01] Add metrics server and introduce metrics for [CLI-01, SIGN-01, API-01] #46

Description

@linear-code

Why

Gate A needs operational metrics, but the metrics server and bounded-label design are separate from the completed CLI-01, SIGN-01, and API-01 implementation scopes.

Tasks

  • Add --metrics, --metrics.port, and --metrics.address following Lodestar's existing option shape and defaults.
  • Create the registry in packages/cli and start the HTTP metrics server without making @lodestar/builder depend on @lodestar/beacon-node.
  • Thread the registry through BuilderOptions and implement getMetrics(register).
  • Close the metrics server through graceful-shutdown callbacks and prove that the Builder-owned server adds no lingering process handle.
  • Decide whether the server starts before Builder.init so it remains scrapeable while the sidecar waits for readiness.
  • Add bounded Builder status, balance, and node-readiness metrics.
  • Add process start-time and version metrics following Lodestar conventions.
  • Add bid and envelope signature counts and signing duration.
  • Keep label cardinality bounded and never include key, pubkey, index, raw BN response, or other identity material.
  • Test shutdown, restart, process-manager timeout, and Builder cache/reveal recovery against the rc.1/fix: bound network worker termination so shutdown can complete ChainSafe/lodestar#9790/deps: bump @chainsafe/libp2p-quic to 2.1.3 ChainSafe/lodestar#9792 baseline.
  • Record that Lodestar #9793 closed without merge because the proposed self-signal/force-exit approach did not generalize, especially for container PID 1. Do not treat it as the metrics-server fix or claim the underlying network-worker handle is resolved.
  • Confirm a clean local run exposes the endpoint, updates expected values, closes the metrics server, and leaves forced termination to the deployment process manager when Lodestar itself cannot exit.

Done when

A clean local run exposes the expected bounded metrics, the metrics server starts and stops without preventing Builder shutdown, and the evidence distinguishes Builder-owned handles from the unresolved Lodestar network-worker shutdown problem.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions