Skip to content

Add Prometheus Metrics Exporter + Grafana Dashboard (Bounty #504) - #474

Closed
ansomeck wants to merge 5 commits into
Scottcjn:mainfrom
ansomeck:prometheus-exporter
Closed

ansomeck wants to merge 5 commits into
Scottcjn:mainfrom
ansomeck:prometheus-exporter

Conversation

@ansomeck

@ansomeck ansomeck commented Mar 1, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR adds a complete Prometheus monitoring solution for RustChain nodes.

Features

✅ Prometheus Exporter

  • Scrapes RustChain API every 60 seconds
  • Exposes metrics on :9100/metrics
  • Configurable via environment variables

✅ Grafana Dashboard

  • 10 pre-built panels
  • Node status, uptime, epoch progress
  • Active/enrolled miners chart
  • Top 10 miner balances table
  • Hall of Fame statistics
  • Auto-refresh every 30 seconds

✅ Docker Compose Setup

  • One-command deployment
  • Includes exporter + Prometheus + Grafana
  • Automatic dashboard provisioning

✅ Alert Rules

  • RustChainNodeDown (node offline >5min)
  • MinerOffline (no attestation >30min)
  • LowMinerBalance (balance <10 RTC)
  • FewActiveMiners (<5 active)
  • EpochStalled (no new slots >10min)

✅ Production Ready

  • Systemd service file included
  • Comprehensive README
  • Dockerfile for containerized deployment

Testing

Tested against https://rustchain.org API - all endpoints working correctly.

Bounty

Closes #504 (40 RTC base + 15 RTC bonus = 55 RTC total)

RTC Wallet: RTCf4c3ff0e8443fb3c4206cde61cab

Ready for review! 🚀

- Prometheus-compatible metrics exporter for RustChain nodes
- Collects metrics: node health, miners, epoch, balances, Hall of Fame, fees
- Pre-built Grafana dashboard with 10 panels
- Docker Compose setup (exporter + Prometheus + Grafana)
- Alert rules for node health, miner status, and balances
- Systemd service file for production deployment
- Comprehensive README with setup instructions

Metrics exposed on :9100/metrics
Grafana dashboard auto-refresh every 30s

Closes Scottcjn#504
@github-actions github-actions Bot added documentation Improvements or additions to documentation BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) size/L PR: 201-500 lines labels Mar 1, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Your PR has a BCOS-L1 or BCOS-L2 label
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

ansomeck added 4 commits March 1, 2026 15:02
- Use stats object from API instead of iterating categories
- Fix epoch_seconds_remaining to handle negative values
- All metrics now working correctly
- Was showing 88.44 instead of 0.44 (wrong by 100x)
- Now correctly uses (slot % blocks) / blocks for 0-1 range
- epoch_seconds_remaining now calculates remaining blocks in current epoch
- Matches bounty requirements exactly
@Scottcjn

Scottcjn commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Closing — @Joshualover submitted #472 for this bounty ~80 minutes earlier. First complete PR wins. Thanks @ansomeck.

@Scottcjn Scottcjn closed this Mar 1, 2026
lustsazeus-lab pushed a commit to lustsazeus-lab/Rustchain that referenced this pull request Mar 2, 2026
createkr pushed a commit to createkr/Rustchain that referenced this pull request Mar 10, 2026
…tor + Cross-Node Replay harness

Add deterministic epoch simulation tooling with reproducible state transitions
and cross-node replay verification for RustChain consensus.

Components:
- src/epoch_determinism_simulator.py: Deterministic PRNG-based simulator
  with seeded reproducibility, antiquity-weighted block production,
  epoch finalization, and state hash computation
- src/cross_node_replay.py: Cross-node replay harness for recording
  simulation logs and verifying state convergence across multiple nodes
- tests/: Unit and integration tests (33 tests covering RNG, simulation,
  replay, and determinism verification)
- fixtures/: Predefined scenarios (basic, single miner, stress, seed test)
- docs/: IMPLEMENTATION.md (design details), RUNBOOK.md (operations guide)
- scripts/: run_tests.sh, collect_evidence.py for CI/verification

Verification:
- All 33 tests pass
- Multi-node determinism check: PASS (identical state hashes)
- Replay verification: PASS (3 runs produce identical results)
- Evidence collected in bounties/issue-474/evidence/
Scottcjn added a commit that referenced this pull request Mar 10, 2026
…-simulator

feat: epoch determinism simulator + cross-node replay harness (#474)
yifan19860831-hub added a commit to yifan19860831-hub/Rustchain that referenced this pull request Mar 13, 2026
createkr pushed a commit to createkr/Rustchain that referenced this pull request Mar 22, 2026
…tor + Cross-Node Replay harness

Add deterministic epoch simulation tooling with reproducible state transitions
and cross-node replay verification for RustChain consensus.

Components:
- src/epoch_determinism_simulator.py: Deterministic PRNG-based simulator
  with seeded reproducibility, antiquity-weighted block production,
  epoch finalization, and state hash computation
- src/cross_node_replay.py: Cross-node replay harness for recording
  simulation logs and verifying state convergence across multiple nodes
- tests/: Unit and integration tests (33 tests covering RNG, simulation,
  replay, and determinism verification)
- fixtures/: Predefined scenarios (basic, single miner, stress, seed test)
- docs/: IMPLEMENTATION.md (design details), RUNBOOK.md (operations guide)
- scripts/: run_tests.sh, collect_evidence.py for CI/verification

Verification:
- All 33 tests pass
- Multi-node determinism check: PASS (identical state hashes)
- Replay verification: PASS (3 runs produce identical results)
- Evidence collected in bounties/issue-474/evidence/
createkr pushed a commit to createkr/Rustchain that referenced this pull request Mar 22, 2026
…erminism-simulator

feat: epoch determinism simulator + cross-node replay harness (Scottcjn#474)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) documentation Improvements or additions to documentation size/L PR: 201-500 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants