Skip to content

Prometheus exporter should not import-crash on malformed numeric env #7321

Description

@yyswhsccc

Summary

tools/prometheus/rustchain_exporter.py parses EXPORTER_PORT, SCRAPE_INTERVAL, and REQUEST_TIMEOUT with module-level int(os.getenv(...)) calls.

If any of those environment variables are present but malformed, importing the exporter crashes before the service can start or report a useful configuration problem.

Impact

A single typo such as EXPORTER_PORT=not-a-port or REQUEST_TIMEOUT=NaN can turn a monitoring configuration mistake into an import-time crash. This is avoidable for an ops/monitoring tool where safe defaults already exist.

Expected

Numeric environment variables should fall back to the existing defaults when missing, empty, or malformed, without changing normal valid configuration behavior.

Scope

Small monitoring-tool hardening only. No node, wallet, transfer, reward, payout, admin-key, or production behavior changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagedReviewed and categorized

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions