Skip to content

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

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

Add Prometheus Metrics Exporter + Grafana Dashboard (Bounty #504)#474
ansomeck wants to merge 5 commits intoScottcjn:mainfrom
ansomeck:prometheus-exporter

Conversation

@ansomeck
Copy link
Contributor

@ansomeck ansomeck commented Mar 1, 2026

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
Copy link

@github-actions github-actions bot left a comment

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
Copy link
Owner

Scottcjn commented Mar 1, 2026

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
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