Skip to content

[P0] time_since_last_block never grows on chain halt when drift monitoring is enabled #34

Closed

Description

@auricom

Priority: P0 (bug) · Effort: S

Problem

When drift monitoring is enabled (--reference-node + --full-nodes), pkg/exporters/drift/drift.go:66 and :85 call m.UpdateLastBlockTime(chainID, time.Now()) on every successful poll, whether or not the height advanced.

If the chain halts, ev_metrics_time_since_last_block_seconds is reset to 0 every --polling-interval (default 10s), so a "no new block for N seconds" alert never fires. That alert is the main reason this metric exists.

Proposed fix

  • Keep lastHeight uint64 on the drift exporter.
  • Call UpdateLastBlockTime only when refHeight > lastHeight.
  • Remove the per-full-node UpdateLastBlockTime call. A full node catching up doesn't mean the chain produced a block.

Pros / Cons

Acceptance criteria

  • New pkg/exporters/drift/drift_test.go: an httptest JSON-RPC server returns a constant eth_blockNumber, and the test asserts time_since_last_block_seconds keeps growing.
  • A height that goes backwards (reorg or endpoint switch) doesn't reset the gauge.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions