Skip to content

feat: bounty #765 Prometheus Metrics Exporter#757

Merged
Scottcjn merged 1 commit intoScottcjn:mainfrom
createkr:feat/issue765-prometheus-exporter-v2
Mar 9, 2026
Merged

feat: bounty #765 Prometheus Metrics Exporter#757
Scottcjn merged 1 commit intoScottcjn:mainfrom
createkr:feat/issue765-prometheus-exporter-v2

Conversation

@createkr
Copy link
Copy Markdown
Contributor

@createkr createkr commented Mar 9, 2026

Implements #765 Prometheus exporter with metrics endpoints, tests, docs, and alerting examples in strict one-bounty scope.\n\nPayout wallet: RTC1d48d848a5aa5ecf2c5f01aa5fb64837daaf2f35 (split: createkr-wallet).

Complete Prometheus metrics exporter for RustChain nodes with:
- Real endpoint integration (/health, /epoch, /api/miners)
- Prometheus text exposition format generation
- Comprehensive metrics: node health, epoch stats, miner analytics
- Alerting rules for critical and warning scenarios
- Docker Compose deployment with full monitoring stack
- 32 unit and integration tests (>90% coverage target)
- Complete documentation (README, runbook, metrics reference)

Components:
- src/rustchain_exporter.py: Main exporter (650 LOC)
- src/metrics_exposition.py: Standalone exposition module (280 LOC)
- tests/test_exporter.py: Comprehensive test suite
- examples/: Docker Compose, Prometheus config, alerting rules
- docs/: Implementation details, runbook, metrics reference

Metrics exposed:
- Node health: rustchain_node_health, uptime, db_status, version
- Epoch: epoch_number, slot, pot_rtc, enrolled_miners, total_supply
- Miners: active_miners, by_hardware, by_architecture, antiquity stats
- Exporter: scrape_duration, scrapes_total, scrape_errors_total

Alerting rules included:
- Critical: NodeDown, DatabaseError, NoActiveMiners, EpochStuck
- Warning: TipStale, BackupOld, MinerDrop, LowAntiquity, SlowScrape
@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/XL PR: 500+ lines labels Mar 9, 2026
Copy link
Copy Markdown
Contributor

@MontaEllis8 MontaEllis8 left a comment

Choose a reason for hiding this comment

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

Good implementation of Prometheus metrics exporter. Consider adding metric cardinality warnings for high-cardinality labels.

@Scottcjn Scottcjn merged commit 2bf09fc into Scottcjn:main Mar 9, 2026
5 of 6 checks passed
mgrigajtis pushed a commit to mgrigajtis/Rustchain that referenced this pull request Mar 16, 2026
…ode (Scottcjn#641)

* feat(rip-0002): On-Chain Governance System — proposal creation, voting, lifecycle, Sophia AI analysis

Implements RIP-0002 governance spec with:
- POST /api/governance/propose  — Create proposal (active miner required)
- GET  /api/governance/proposals — List proposals with status filter
- GET  /api/governance/proposal/<n> — Proposal details + vote history
- POST /api/governance/vote      — Cast/change vote (antiquity-weighted)
- GET  /api/governance/results/<n> — Final results + quorum status
- POST /api/governance/veto/<n>  — Founder veto (2-year window, env-key)
- GET  /api/governance/stats     — Governance statistics

Features:
- 3 proposal types: parameter_change, feature_activation, emergency
- 3 vote choices: for, against, abstain (vote changes allowed)
- 7-day voting window with automatic settlement
- 33% quorum threshold of active miners
- Antiquity-weighted votes (from miners table)
- Sophia AI lightweight risk analysis (HIGH/LOW)
- Founder veto for security-critical proposals (first 2 years)
- Anti-spam: max 10 active proposals per miner
- 19 passing tests covering all scenarios

Bounty: Scottcjn/rustchain-bounties#761
Wallet: nox-ventures

* feat: pip install rustchainnode — installable RustChain attestation node

Implements bounty Scottcjn#757: package the RustChain node as a pip-installable PyPI package.

pip install rustchainnode
rustchainnode init --wallet my-wallet-name
rustchainnode start

Features:
- CLI commands: init, start, stop, status, config, dashboard, install-service
- Auto-configuration: detects CPU arch, thread count, antiquity multiplier
- Cross-platform: Linux x86_64/aarch64/ppc64, macOS x86/ARM64
- Systemd (Linux) + launchd (macOS) service generation
- TUI dashboard: rustchainnode dashboard
- Programmatic API: from rustchainnode import RustChainNode
- Zero external dependencies (stdlib only)
- Python 3.9+ compatible

Bounty: Scottcjn/rustchain-bounties#757
Wallet: nox-ventures
mgrigajtis pushed a commit to mgrigajtis/Rustchain that referenced this pull request Mar 16, 2026
* feat(rip-0002): On-Chain Governance System — proposal creation, voting, lifecycle, Sophia AI analysis

Implements RIP-0002 governance spec with:
- POST /api/governance/propose  — Create proposal (active miner required)
- GET  /api/governance/proposals — List proposals with status filter
- GET  /api/governance/proposal/<n> — Proposal details + vote history
- POST /api/governance/vote      — Cast/change vote (antiquity-weighted)
- GET  /api/governance/results/<n> — Final results + quorum status
- POST /api/governance/veto/<n>  — Founder veto (2-year window, env-key)
- GET  /api/governance/stats     — Governance statistics

Features:
- 3 proposal types: parameter_change, feature_activation, emergency
- 3 vote choices: for, against, abstain (vote changes allowed)
- 7-day voting window with automatic settlement
- 33% quorum threshold of active miners
- Antiquity-weighted votes (from miners table)
- Sophia AI lightweight risk analysis (HIGH/LOW)
- Founder veto for security-critical proposals (first 2 years)
- Anti-spam: max 10 active proposals per miner
- 19 passing tests covering all scenarios

Bounty: Scottcjn/rustchain-bounties#761
Wallet: nox-ventures

* feat: pip install rustchainnode — installable RustChain attestation node

Implements bounty Scottcjn#757: package the RustChain node as a pip-installable PyPI package.

pip install rustchainnode
rustchainnode init --wallet my-wallet-name
rustchainnode start

Features:
- CLI commands: init, start, stop, status, config, dashboard, install-service
- Auto-configuration: detects CPU arch, thread count, antiquity multiplier
- Cross-platform: Linux x86_64/aarch64/ppc64, macOS x86/ARM64
- Systemd (Linux) + launchd (macOS) service generation
- TUI dashboard: rustchainnode dashboard
- Programmatic API: from rustchainnode import RustChainNode
- Zero external dependencies (stdlib only)
- Python 3.9+ compatible

Bounty: Scottcjn/rustchain-bounties#757
Wallet: nox-ventures

* feat: cross-node ledger verification tool (Scottcjn#763)

Queries all 3 RustChain nodes, compares state, alerts on mismatches.

Features:
- Query /health, /epoch, /api/stats, /wallet/balance, /api/miners
- Merkle root computation over sorted active miners list
- SQLite historical tracking (~/.rustchain/ledger_verify.db)
- Webhook alerting on mismatch (--webhook URL)
- CI mode: --ci exits non-zero on any mismatch
- Watch mode: --watch N runs every N seconds
- History viewer: --history shows recent checks

Sample output:
  Node 1 (Primary): v2.2.1-rip200 ✅ epoch=94 slot=13601
  Node 2: v1.2.0 ✅ epoch=94 slot=13601
  Node 3 (Ryan): ❌ unreachable (Tailscale)
  Merkle roots: node1=e318be4c... (both match ✅)
  Result: ✅ ALL NODES IN SYNC

GitHub Actions: runs every 6h, CI mode, webhook on mismatch.

Bounty: Scottcjn/rustchain-bounties#763
Wallet: nox-ventures

* chore: remove workflow (scope issue, add manually)
mgrigajtis pushed a commit to mgrigajtis/Rustchain that referenced this pull request Mar 16, 2026
…Scottcjn#643)

* feat(rip-0002): On-Chain Governance System — proposal creation, voting, lifecycle, Sophia AI analysis

Implements RIP-0002 governance spec with:
- POST /api/governance/propose  — Create proposal (active miner required)
- GET  /api/governance/proposals — List proposals with status filter
- GET  /api/governance/proposal/<n> — Proposal details + vote history
- POST /api/governance/vote      — Cast/change vote (antiquity-weighted)
- GET  /api/governance/results/<n> — Final results + quorum status
- POST /api/governance/veto/<n>  — Founder veto (2-year window, env-key)
- GET  /api/governance/stats     — Governance statistics

Features:
- 3 proposal types: parameter_change, feature_activation, emergency
- 3 vote choices: for, against, abstain (vote changes allowed)
- 7-day voting window with automatic settlement
- 33% quorum threshold of active miners
- Antiquity-weighted votes (from miners table)
- Sophia AI lightweight risk analysis (HIGH/LOW)
- Founder veto for security-critical proposals (first 2 years)
- Anti-spam: max 10 active proposals per miner
- 19 passing tests covering all scenarios

Bounty: Scottcjn/rustchain-bounties#761
Wallet: nox-ventures

* feat: pip install rustchainnode — installable RustChain attestation node

Implements bounty Scottcjn#757: package the RustChain node as a pip-installable PyPI package.

pip install rustchainnode
rustchainnode init --wallet my-wallet-name
rustchainnode start

Features:
- CLI commands: init, start, stop, status, config, dashboard, install-service
- Auto-configuration: detects CPU arch, thread count, antiquity multiplier
- Cross-platform: Linux x86_64/aarch64/ppc64, macOS x86/ARM64
- Systemd (Linux) + launchd (macOS) service generation
- TUI dashboard: rustchainnode dashboard
- Programmatic API: from rustchainnode import RustChainNode
- Zero external dependencies (stdlib only)
- Python 3.9+ compatible

Bounty: Scottcjn/rustchain-bounties#757
Wallet: nox-ventures

* feat: cross-node ledger verification tool (Scottcjn#763)

Queries all 3 RustChain nodes, compares state, alerts on mismatches.

Features:
- Query /health, /epoch, /api/stats, /wallet/balance, /api/miners
- Merkle root computation over sorted active miners list
- SQLite historical tracking (~/.rustchain/ledger_verify.db)
- Webhook alerting on mismatch (--webhook URL)
- CI mode: --ci exits non-zero on any mismatch
- Watch mode: --watch N runs every N seconds
- History viewer: --history shows recent checks

Sample output:
  Node 1 (Primary): v2.2.1-rip200 ✅ epoch=94 slot=13601
  Node 2: v1.2.0 ✅ epoch=94 slot=13601
  Node 3 (Ryan): ❌ unreachable (Tailscale)
  Merkle roots: node1=e318be4c... (both match ✅)
  Result: ✅ ALL NODES IN SYNC

GitHub Actions: runs every 6h, CI mode, webhook on mismatch.

Bounty: Scottcjn/rustchain-bounties#763
Wallet: nox-ventures

* chore: remove workflow (scope issue, add manually)

* feat: attestation fuzz harness (Scottcjn#762)

Property-based fuzz testing for POST /attest/submit.

Mutation strategies (11 total):
- missing_field: Remove required fields at any nesting level
- wrong_type: Replace field with wrong type (None, int, list, dict, float)
- unknown_field: Inject unknown keys at any nesting level
- nested_bomb: Create deeply nested structures (100-500 levels)
- array_overflow: Huge MAC address arrays (1000-10000 entries)
- float_edge: inf, nan, -inf, 1e308 in fingerprint data
- unicode_miner: null bytes, RTL override, emoji, path traversal, SQLi
- huge_miner: wallet names up to 1MB
- null_miner: explicit null value
- empty_payload: {}
- not_json: random binary garbage with wrong Content-Type

Crash detection:
- HTTP 5xx = server error
- Timeout (>90% of TIMEOUT) = potential DoS
- Traceback/exception in response body
- Connection refused (server crash)

Features:
- --count N: configurable iteration count (default 1000)
- --save-corpus: save all generated payloads to fuzz_corpus/
- --ci: exit non-zero on crash found
- --report: show saved crash report
- --url: override target URL

Bounty: Scottcjn/rustchain-bounties#762
Wallet: nox-ventures
createkr pushed a commit to createkr/Rustchain that referenced this pull request Mar 22, 2026
…ode (Scottcjn#641)

* feat(rip-0002): On-Chain Governance System — proposal creation, voting, lifecycle, Sophia AI analysis

Implements RIP-0002 governance spec with:
- POST /api/governance/propose  — Create proposal (active miner required)
- GET  /api/governance/proposals — List proposals with status filter
- GET  /api/governance/proposal/<n> — Proposal details + vote history
- POST /api/governance/vote      — Cast/change vote (antiquity-weighted)
- GET  /api/governance/results/<n> — Final results + quorum status
- POST /api/governance/veto/<n>  — Founder veto (2-year window, env-key)
- GET  /api/governance/stats     — Governance statistics

Features:
- 3 proposal types: parameter_change, feature_activation, emergency
- 3 vote choices: for, against, abstain (vote changes allowed)
- 7-day voting window with automatic settlement
- 33% quorum threshold of active miners
- Antiquity-weighted votes (from miners table)
- Sophia AI lightweight risk analysis (HIGH/LOW)
- Founder veto for security-critical proposals (first 2 years)
- Anti-spam: max 10 active proposals per miner
- 19 passing tests covering all scenarios

Bounty: Scottcjn/rustchain-bounties#761
Wallet: nox-ventures

* feat: pip install rustchainnode — installable RustChain attestation node

Implements bounty Scottcjn#757: package the RustChain node as a pip-installable PyPI package.

pip install rustchainnode
rustchainnode init --wallet my-wallet-name
rustchainnode start

Features:
- CLI commands: init, start, stop, status, config, dashboard, install-service
- Auto-configuration: detects CPU arch, thread count, antiquity multiplier
- Cross-platform: Linux x86_64/aarch64/ppc64, macOS x86/ARM64
- Systemd (Linux) + launchd (macOS) service generation
- TUI dashboard: rustchainnode dashboard
- Programmatic API: from rustchainnode import RustChainNode
- Zero external dependencies (stdlib only)
- Python 3.9+ compatible

Bounty: Scottcjn/rustchain-bounties#757
Wallet: nox-ventures
createkr pushed a commit to createkr/Rustchain that referenced this pull request Mar 22, 2026
* feat(rip-0002): On-Chain Governance System — proposal creation, voting, lifecycle, Sophia AI analysis

Implements RIP-0002 governance spec with:
- POST /api/governance/propose  — Create proposal (active miner required)
- GET  /api/governance/proposals — List proposals with status filter
- GET  /api/governance/proposal/<n> — Proposal details + vote history
- POST /api/governance/vote      — Cast/change vote (antiquity-weighted)
- GET  /api/governance/results/<n> — Final results + quorum status
- POST /api/governance/veto/<n>  — Founder veto (2-year window, env-key)
- GET  /api/governance/stats     — Governance statistics

Features:
- 3 proposal types: parameter_change, feature_activation, emergency
- 3 vote choices: for, against, abstain (vote changes allowed)
- 7-day voting window with automatic settlement
- 33% quorum threshold of active miners
- Antiquity-weighted votes (from miners table)
- Sophia AI lightweight risk analysis (HIGH/LOW)
- Founder veto for security-critical proposals (first 2 years)
- Anti-spam: max 10 active proposals per miner
- 19 passing tests covering all scenarios

Bounty: Scottcjn/rustchain-bounties#761
Wallet: nox-ventures

* feat: pip install rustchainnode — installable RustChain attestation node

Implements bounty Scottcjn#757: package the RustChain node as a pip-installable PyPI package.

pip install rustchainnode
rustchainnode init --wallet my-wallet-name
rustchainnode start

Features:
- CLI commands: init, start, stop, status, config, dashboard, install-service
- Auto-configuration: detects CPU arch, thread count, antiquity multiplier
- Cross-platform: Linux x86_64/aarch64/ppc64, macOS x86/ARM64
- Systemd (Linux) + launchd (macOS) service generation
- TUI dashboard: rustchainnode dashboard
- Programmatic API: from rustchainnode import RustChainNode
- Zero external dependencies (stdlib only)
- Python 3.9+ compatible

Bounty: Scottcjn/rustchain-bounties#757
Wallet: nox-ventures

* feat: cross-node ledger verification tool (Scottcjn#763)

Queries all 3 RustChain nodes, compares state, alerts on mismatches.

Features:
- Query /health, /epoch, /api/stats, /wallet/balance, /api/miners
- Merkle root computation over sorted active miners list
- SQLite historical tracking (~/.rustchain/ledger_verify.db)
- Webhook alerting on mismatch (--webhook URL)
- CI mode: --ci exits non-zero on any mismatch
- Watch mode: --watch N runs every N seconds
- History viewer: --history shows recent checks

Sample output:
  Node 1 (Primary): v2.2.1-rip200 ✅ epoch=94 slot=13601
  Node 2: v1.2.0 ✅ epoch=94 slot=13601
  Node 3 (Ryan): ❌ unreachable (Tailscale)
  Merkle roots: node1=e318be4c... (both match ✅)
  Result: ✅ ALL NODES IN SYNC

GitHub Actions: runs every 6h, CI mode, webhook on mismatch.

Bounty: Scottcjn/rustchain-bounties#763
Wallet: nox-ventures

* chore: remove workflow (scope issue, add manually)
createkr pushed a commit to createkr/Rustchain that referenced this pull request Mar 22, 2026
…Scottcjn#643)

* feat(rip-0002): On-Chain Governance System — proposal creation, voting, lifecycle, Sophia AI analysis

Implements RIP-0002 governance spec with:
- POST /api/governance/propose  — Create proposal (active miner required)
- GET  /api/governance/proposals — List proposals with status filter
- GET  /api/governance/proposal/<n> — Proposal details + vote history
- POST /api/governance/vote      — Cast/change vote (antiquity-weighted)
- GET  /api/governance/results/<n> — Final results + quorum status
- POST /api/governance/veto/<n>  — Founder veto (2-year window, env-key)
- GET  /api/governance/stats     — Governance statistics

Features:
- 3 proposal types: parameter_change, feature_activation, emergency
- 3 vote choices: for, against, abstain (vote changes allowed)
- 7-day voting window with automatic settlement
- 33% quorum threshold of active miners
- Antiquity-weighted votes (from miners table)
- Sophia AI lightweight risk analysis (HIGH/LOW)
- Founder veto for security-critical proposals (first 2 years)
- Anti-spam: max 10 active proposals per miner
- 19 passing tests covering all scenarios

Bounty: Scottcjn/rustchain-bounties#761
Wallet: nox-ventures

* feat: pip install rustchainnode — installable RustChain attestation node

Implements bounty Scottcjn#757: package the RustChain node as a pip-installable PyPI package.

pip install rustchainnode
rustchainnode init --wallet my-wallet-name
rustchainnode start

Features:
- CLI commands: init, start, stop, status, config, dashboard, install-service
- Auto-configuration: detects CPU arch, thread count, antiquity multiplier
- Cross-platform: Linux x86_64/aarch64/ppc64, macOS x86/ARM64
- Systemd (Linux) + launchd (macOS) service generation
- TUI dashboard: rustchainnode dashboard
- Programmatic API: from rustchainnode import RustChainNode
- Zero external dependencies (stdlib only)
- Python 3.9+ compatible

Bounty: Scottcjn/rustchain-bounties#757
Wallet: nox-ventures

* feat: cross-node ledger verification tool (Scottcjn#763)

Queries all 3 RustChain nodes, compares state, alerts on mismatches.

Features:
- Query /health, /epoch, /api/stats, /wallet/balance, /api/miners
- Merkle root computation over sorted active miners list
- SQLite historical tracking (~/.rustchain/ledger_verify.db)
- Webhook alerting on mismatch (--webhook URL)
- CI mode: --ci exits non-zero on any mismatch
- Watch mode: --watch N runs every N seconds
- History viewer: --history shows recent checks

Sample output:
  Node 1 (Primary): v2.2.1-rip200 ✅ epoch=94 slot=13601
  Node 2: v1.2.0 ✅ epoch=94 slot=13601
  Node 3 (Ryan): ❌ unreachable (Tailscale)
  Merkle roots: node1=e318be4c... (both match ✅)
  Result: ✅ ALL NODES IN SYNC

GitHub Actions: runs every 6h, CI mode, webhook on mismatch.

Bounty: Scottcjn/rustchain-bounties#763
Wallet: nox-ventures

* chore: remove workflow (scope issue, add manually)

* feat: attestation fuzz harness (Scottcjn#762)

Property-based fuzz testing for POST /attest/submit.

Mutation strategies (11 total):
- missing_field: Remove required fields at any nesting level
- wrong_type: Replace field with wrong type (None, int, list, dict, float)
- unknown_field: Inject unknown keys at any nesting level
- nested_bomb: Create deeply nested structures (100-500 levels)
- array_overflow: Huge MAC address arrays (1000-10000 entries)
- float_edge: inf, nan, -inf, 1e308 in fingerprint data
- unicode_miner: null bytes, RTL override, emoji, path traversal, SQLi
- huge_miner: wallet names up to 1MB
- null_miner: explicit null value
- empty_payload: {}
- not_json: random binary garbage with wrong Content-Type

Crash detection:
- HTTP 5xx = server error
- Timeout (>90% of TIMEOUT) = potential DoS
- Traceback/exception in response body
- Connection refused (server crash)

Features:
- --count N: configurable iteration count (default 1000)
- --save-corpus: save all generated payloads to fuzz_corpus/
- --ci: exit non-zero on crash found
- --report: show saved crash report
- --url: override target URL

Bounty: Scottcjn/rustchain-bounties#762
Wallet: nox-ventures
createkr added a commit to createkr/Rustchain that referenced this pull request Mar 22, 2026
)

Complete Prometheus metrics exporter for RustChain nodes with:
- Real endpoint integration (/health, /epoch, /api/miners)
- Prometheus text exposition format generation
- Comprehensive metrics: node health, epoch stats, miner analytics
- Alerting rules for critical and warning scenarios
- Docker Compose deployment with full monitoring stack
- 32 unit and integration tests (>90% coverage target)
- Complete documentation (README, runbook, metrics reference)

Components:
- src/rustchain_exporter.py: Main exporter (650 LOC)
- src/metrics_exposition.py: Standalone exposition module (280 LOC)
- tests/test_exporter.py: Comprehensive test suite
- examples/: Docker Compose, Prometheus config, alerting rules
- docs/: Implementation details, runbook, metrics reference

Metrics exposed:
- Node health: rustchain_node_health, uptime, db_status, version
- Epoch: epoch_number, slot, pot_rtc, enrolled_miners, total_supply
- Miners: active_miners, by_hardware, by_architecture, antiquity stats
- Exporter: scrape_duration, scrapes_total, scrape_errors_total

Alerting rules included:
- Critical: NodeDown, DatabaseError, NoActiveMiners, EpochStuck
- Warning: TipStale, BackupOld, MinerDrop, LowAntiquity, SlowScrape

Co-authored-by: createkr <createkr@proton.me>
@Scottcjn
Copy link
Copy Markdown
Owner

Scottcjn commented Apr 2, 2026

Transfer confirmed — this was included in the batch settlement of 1,091 RTC to @createkr's wallet.

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/XL PR: 500+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants