Skip to content

Latest commit

 

History

History
261 lines (195 loc) · 7.59 KB

File metadata and controls

261 lines (195 loc) · 7.59 KB
Screenshot 2026-02-27 232126

Predictive Infrastructure Intelligence Platform

CI Release License

PreScale uses machine learning to forecast infrastructure demand, detect anomalies, and provide proactive scaling recommendations. It supports multi-cloud metrics collection, real-time dashboards, and extensible agent architecture.


🚀 Quick Start

Option 1: Docker (Easiest)

docker run -d -p 8080:8080 ghcr.io/pyjeebz/prescale/inference:latest
# Open http://localhost:8080

Option 2: Local Development

Prerequisites: Python 3.10+, Node.js 18+

# Clone and setup
git clone https://github.com/pyjeebz/prescale.git
cd prescale

# Python environment
python -m venv .venv
.venv\Scripts\activate         # Windows
# source .venv/bin/activate    # macOS/Linux
pip install -r ml/inference/requirements.txt

# Start backend (Terminal 1)
python -m uvicorn ml.inference.app:app --host 0.0.0.0 --port 8080

# Start frontend (Terminal 2)
cd ml/inference/web
npm install
npm run dev
# Open http://localhost:3000

Option 3: Kubernetes (Helm)

helm repo add prescale https://pyjeebz.github.io/prescale
helm install prescale prescale/prescale

First Steps After Setup

  1. Deployments → Create a deployment (e.g., my-app-prod)
  2. Install Agent → Copy commands, run on your server
  3. Dashboard → View predictions, anomalies, recommendations

🎯 Features

Feature Description
Traffic Forecasting Predict CPU, memory, and request rates
Anomaly Detection Real-time detection using ML/statistics
Scaling Recommendations Proactive advice for resource scaling
Multi-Cloud Support GCP, AWS, Azure, Prometheus, custom sources
Web Dashboard Real-time charts, agent map, predictions, anomalies
CLI Tools prescale CLI for predictions, anomaly detection, recommendations
Pluggable Storage In-memory (dev), PostgreSQL, TimescaleDB, InfluxDB (planned)

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│  Prescale Agent ──► ML Pipeline ──► Inference Service (API)  │
│     │                │                │                     │
│     ▼                ▼                ▼                     │
│  Metrics         Training         Predictions/Anomalies     │
│     │                │                │                     │
│     └─────────────► Storage Backend (pluggable)             │
└─────────────────────────────────────────────────────────────┘

📁 Project Structure

prescale/
├── agent/              # Metrics collection agent (pluggable sources)
├── cli/                # CLI tools for predictions/anomalies/recommendations
├── ml/                 # ML models, training, inference service (FastAPI)
│   └── inference/web/  # Vue.js web dashboard
├── infra/              # Kubernetes, Terraform, Docker, Helm
├── charts/prescale/    # Helm chart
├── docs/               # Documentation

🤖 Prescale Agent

Collects metrics from:

  • System (CPU, memory, disk, network)
  • Prometheus
  • GCP Cloud Monitoring
  • AWS CloudWatch (planned)
  • Azure Monitor (planned)
  • Datadog (planned)

Installation

pip install prescale-agent
pip install prescale-agent[gcp]      # GCP
pip install prescale-agent[aws]      # AWS
pip install prescale-agent[azure]    # Azure
pip install prescale-agent[all]      # All backends

Configuration

agent:
  collection_interval: 60
  log_level: INFO

sources:
  - type: system
    enabled: true
    config:
      collect_cpu: true
      collect_memory: true
  - type: prometheus
    enabled: true
    config:
      url: http://prometheus:9090
      queries:
        - name: cpu_usage
          query: rate(container_cpu_usage_seconds_total[5m])
prescale:
  endpoint: http://prescale-inference:8080

🖥️ Web Dashboard

The Vue.js dashboard provides AI-powered insights for your infrastructure:

Feature Description
Multi-Deployment Management Create and switch between deployments (prod, staging, dev)
Agent Installation Copy-paste commands with live connection status
AI Predictions Forecast CPU, memory, and resource usage
Anomaly Detection Real-time detection of unusual patterns
Recommendations Proactive scaling advice with confidence scores

Running the Dashboard

cd ml/inference/web
npm install
npm run dev        # Development: http://localhost:3000
npm run build      # Production build to ../static

User Flow

  1. Create a deployment (/deployments) - e.g., ecommerce-prod
  2. Install the agent (/install) - copy commands, run on your server
  3. View AI insights - predictions, anomalies, and recommendations appear automatically

🧠 ML Training

  • Baseline (moving average/trend)
  • Prophet (seasonality)
  • XGBoost (anomaly detection)
  • Models train on collected metrics (manual/auto)

🔌 API Endpoints

Endpoint Method Description
/health GET Service health check
/api/v1/ingest POST Ingest metrics from agent
/api/v1/predict POST Forecast future metrics
/api/v1/detect POST Anomaly detection
/api/v1/recommend POST Scaling recommendations
/api/metrics GET List available metric names
/api/metrics/{name} GET Get time-series data

☸️ Kubernetes Deployment

  • Helm chart for easy install
  • K8s manifests for inference service, monitoring, autoscaling

📈 Roadmap

✅ Completed

  • Agent with pluggable backends (GCP, Prometheus, System)
  • ML pipeline (Baseline, Prophet, XGBoost)
  • Inference service (FastAPI)
  • CLI tools (predict, detect, recommend)
  • Kubernetes/Helm deployment
  • Web dashboard (Vue.js) with multi-deployment support
  • Agent installation flow
  • AI-focused insights (predictions, anomalies, recommendations)
  • Automated model retraining (GCP/AWS integration)
  • Agent management controls (pause/resume, collection interval)

🚧 In Progress

  • Pluggable storage backend (SQLite supported, others planned)

🔮 Future

  • Multi-cluster support
  • Deep learning models (LSTM, Transformer)
  • Alerting integrations (Slack, PagerDuty)
  • User authentication/RBAC
  • Landing page

🧪 Testing

cd ml && pytest tests/
cd agent && pytest
cd cli && pytest

📝 License

Apache 2.0 - See LICENSE


🤝 Contributing

See CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open a Pull Request