Skip to content

[PR #32] info! per block floods logs at BSC cadence; no metrics counters for PR #50 #96

@obchain

Description

@obchain

PR: #32 feat/07-block-listener
File: crates/charon-scanner/src/listener.rs — BlockListener::run_once, inside block drain loop

Problem — log level

info!(
    chain = %self.name,
    block = number,
    timestamp = timestamp,
    "new block"
);

BSC produces block every ~3s. One chain = 28,800 INFO lines per day per deploy. In structured-log pipeline (Loki / CloudWatch / Datadog) this inflates ingestion cost and buries actionable warnings. Correct level for per-block heartbeat is debug!.

Problem — missing metrics

run_once and run have no metrics::counter! instrumentation. README and PR #50 scope require Prometheus counters:

  • charon_listener_connects_total{chain} — incremented at top of each run_once
  • charon_listener_disconnects_total{chain} — incremented when run_once returns Err
  • charon_blocks_received_total{chain} — incremented per block header forwarded

Without these, operators cannot alert on stalled listener or measure block ingestion rate from Grafana.

Fix

  1. Change info! inside drain loop to debug!.
  2. Keep existing info! on subscription-established and warn! on error — those levels correct.
  3. Add metrics::counter! calls at three sites listed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    layer:rustRust crates (core / scanner / protocols / executor / cli)pr-reviewFindings from PR review processpriority:p2-polishNice-to-have / polishtype:featureNew capability or deliverable

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions