Skip to content

pyjeebz/PreScale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

178 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
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