Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 10s
Blockchain Synchronization Verification / sync-verification (push) Failing after 3s
CLI Tests / test-cli (push) Failing after 4s
Documentation Validation / validate-docs (push) Successful in 8s
Documentation Validation / validate-policies-strict (push) Successful in 4s
Integration Tests / test-service-integration (push) Successful in 38s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 3s
Security Scanning / security-scan (push) Successful in 40s
Smart Contract Tests / test-solidity (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Successful in 15s
Smart Contract Tests / lint-solidity (push) Successful in 8s
- Relocate blockchain-event-bridge README content to docs/apps/blockchain/blockchain-event-bridge.md - Relocate blockchain-explorer README content to docs/apps/blockchain/blockchain-explorer.md - Replace app READMEs with redirect notices pointing to new documentation location - Consolidate documentation in central docs/ directory for better organization
2.7 KiB
2.7 KiB
Pool Hub
Purpose & Scope
Matchmaking gateway between coordinator job requests and available miners. See docs/bootstrap/pool_hub.md for architectural guidance.
Development Setup
- Create a Python virtual environment under
apps/pool-hub/.venv. - Install FastAPI, Redis (optional), and PostgreSQL client dependencies once requirements are defined.
- Implement routers and registry as described in the bootstrap document.
SLA Monitoring and Billing Integration
Pool-Hub now includes comprehensive SLA monitoring and billing integration with coordinator-api:
SLA Metrics
- Miner Uptime: Tracks miner availability based on heartbeat intervals
- Response Time: Monitors average response time from match results
- Job Completion Rate: Tracks successful vs failed job outcomes
- Capacity Availability: Monitors overall pool capacity utilization
SLA Thresholds
Default thresholds (configurable in settings):
- Uptime: 95%
- Response Time: 1000ms
- Completion Rate: 90%
- Capacity Availability: 80%
Billing Integration
Pool-Hub integrates with coordinator-api's billing system to:
- Record usage data (gpu_hours, api_calls, compute_hours)
- Sync miner usage to tenant billing
- Generate invoices via coordinator-api
- Track billing metrics and costs
API Endpoints
SLA and billing endpoints are available under /sla/:
GET /sla/metrics/{miner_id}- Get SLA metrics for a minerGET /sla/metrics- Get SLA metrics across all minersGET /sla/violations- Get SLA violationsPOST /sla/metrics/collect- Trigger SLA metrics collectionGET /sla/capacity/snapshots- Get capacity planning snapshotsGET /sla/capacity/forecast- Get capacity forecastGET /sla/capacity/recommendations- Get scaling recommendationsGET /sla/billing/usage- Get billing usage dataPOST /sla/billing/sync- Trigger billing sync with coordinator-api
Configuration
Add to .env:
# Coordinator-API Billing Integration
COORDINATOR_BILLING_URL=http://localhost:8011
COORDINATOR_API_KEY=your_api_key_here
# SLA Configuration
SLA_UPTIME_THRESHOLD=95.0
SLA_RESPONSE_TIME_THRESHOLD=1000.0
SLA_COMPLETION_RATE_THRESHOLD=90.0
SLA_CAPACITY_THRESHOLD=80.0
# Capacity Planning
CAPACITY_FORECAST_HOURS=168
CAPACITY_ALERT_THRESHOLD_PCT=80.0
# Billing Sync
BILLING_SYNC_INTERVAL_HOURS=1
# SLA Collection
SLA_COLLECTION_INTERVAL_SECONDS=300
Database Migration
Run the database migration to add SLA and capacity tables:
cd apps/pool-hub
alembic upgrade head
Testing
Run tests for SLA and billing integration:
cd apps/pool-hub
pytest tests/test_sla_collector.py
pytest tests/test_billing_integration.py
pytest tests/test_sla_endpoints.py
pytest tests/test_integration_coordinator.py