Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevInsight AI — Intelligent DevOps & Incident Management Platform

A platform that monitors microservices, collects logs and metrics, detects failures, and uses a local Ollama LLM (gemma3:1b) to explain incidents and suggest fixes.

                         ┌─────────────┐
                         │   React     │
                         │  (Vite)     │
                         └──────┬──────┘
                                │ HTTP/WS
                         ┌──────▼──────┐
                         │ API Gateway │
                         │ (Spring)    │
                         └──────┬──────┘
                                │
       ┌───────────────────────┼──────────────────────┐
       │          │            │              │        │
 ┌─────▼─────┐ ┌──▼──────┐ ┌──▼──────┐ ┌────▼─────┐   │
 │   Auth    │ │Incident │ │ Metrics │ │   AI     │   │
 │  Service  │ │Service  │ │ Service │ │ Service  │   │
 └─────┬─────┘ └──┬──────┘ └──┬──────┘ └────┬─────┘   │
       │          │           │              │         │
       ▼          ▼           ▼              ▼         │
 ┌────────┐ ┌─────────┐ ┌──────────┐ ┌──────────┐      │
 │Postgres│ │Postgres │ │Postgres  │ │Postgres  │      │
 └────────┘ └─────────┘ └──────────┘ └──────────┘      │
       │          │           │              │          │
       └──────────┴───────────┴──────┬───────┘          │
                                     │                  │
                               ┌─────▼─────┐            │
                               │   Kafka   │            │
                               │ (KRaft)   │            │
                               └─────┬─────┘            │
                                     │                  │
                               ┌─────▼─────┐            │
                               │  Ollama   │            │
                               │ gemma3:1b │            │
                               └───────────┘            │
                                                        │
             ┌──────────────────────────────────────────┘
             │
             ┌──────────────────────────────────────┐
             │ Observability Stack                  │
             │  Grafana ← Prometheus ← /actuator/   │
             │  Grafana ← Loki ← Promtail ← stdout  │
             └──────────────────────────────────────┘

Features

  • Incident Detection — Monitor microservices and detect failures with configurable alert rules
  • AI-Powered Root Cause Analysis — Uses local LLM (gemma3:1b via Ollama) to analyze logs and metrics
  • Real-time Dashboard — See incidents, metrics, and AI analysis in a React frontend
  • Event-Driven Architecture — Kafka-based messaging between services (KRaft mode, no ZooKeeper)
  • Per-Service Databases — True microservices isolation with independent PostgreSQL instances
  • Full Observability Stack — Prometheus metrics, Loki logs, Grafana dashboards
  • CI/CD Ready — GitHub Actions pipeline with build, test, containerization, and deployment

Tech Stack

Layer Technology
Backend Java 21, Spring Boot 4.0, Spring Cloud 2025.1
Frontend React 18, Vite, TypeScript, Zustand, TanStack Query
Database PostgreSQL 16 (per-service), pgvector
Messaging Kafka 3.7 (KRaft, no ZooKeeper)
AI/ML Ollama, gemma3:1b
Container Podman, Podman Compose
CI/CD GitHub Actions
Observability Prometheus, Grafana, Loki, Promtail

Services

Service Port Responsibility
API Gateway 8080 Route requests, JWT validation, rate limiting
Auth Service 8081 User management, JWT issuance, roles
Incident Service 8082 Incident CRUD, lifecycle, Kafka events
Metrics Service 8083 Metrics ingestion (Prometheus format), querying
AI Service 8084 Log analysis, root cause, fix suggestions via Ollama

Architecture

Data Flow — Incident Analysis Pipeline

  1. Microservice crash → error logs emitted
  2. Promtail scrapes logs → ships to Loki
  3. Prometheus scrapes /actuator/prometheus → metrics stored
  4. Alert rule fires → Kafka incident.created event
  5. Incident Service persists incident → publishes event
  6. AI Service consumes event → fetches logs + metrics
  7. AI Service calls Ollama → structured JSON analysis
  8. AI Service stores analysis → publishes incident.analyzed
  9. Incident Service updates → WebSocket push to React UI
  10. Dashboard shows incident + AI root cause + suggested fix

Example AI Analysis

Incident: Order Service crashed

Root Cause:
  Database connection pool exhausted

Evidence:
  - HikariCP timeout errors in logs
  - Connection wait time > 5s

Suggested Fix:
  Increase pool size from 10 to 25
  Check for slow queries in PostgreSQL

Confidence: 87%

Getting Started

Prerequisites

  • Java 21+
  • Maven 3.9+
  • Podman + Podman Compose
  • Node.js 18+
  • Ollama (with gemma3:1b)

Quick Start

# 1. Clone the repository
git clone https://github.com/yourusername/devinsight-ai.git
cd devinsight-ai

# 2. Build all services
mvn clean verify

# 3. Pull the AI model
ollama pull gemma3:1b

# 4. Start infrastructure (PostgreSQL, Kafka, Ollama, etc.)
podman-compose up -d

# 5. Start services (in separate terminals or via podman-compose)
mvn spring-boot:run -pl auth-service
mvn spring-boot:run -pl incident-service
mvn spring-boot:run -pl metrics-service
mvn spring-boot:run -pl ai-service
mvn spring-boot:run -pl api-gateway

# 6. Start frontend
cd frontend
npm install
npm run dev

Verify It Works

# Register a user
curl -X POST http://localhost:8080/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"admin@devinsight.io","password":"admin123","role":"ADMIN"}'

# Login
curl -X POST http://localhost:8080/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"admin@devinsight.io","password":"admin123"}'

# Check API Gateway health
curl http://localhost:8080/actuator/health

Project Structure

devinsight/
├── pom.xml                     # Parent Maven POM
├── docker-compose.yml          # Podman Compose (infrastructure)
├── .github/
│   └── workflows/
│       └── ci.yml              # GitHub Actions CI pipeline
├── devinsight-common/          # Shared DTOs, events, exceptions
├── api-gateway/                # Spring Cloud Gateway
├── auth-service/               # Auth microservice
├── incident-service/           # Incident management
├── metrics-service/            # Metrics ingestion & querying
├── ai-service/                 # AI analysis via Ollama
├── frontend/                   # React + Vite + TypeScript
└── docs/
    └── superpowers/
        └── specs/               # Design documents

CI/CD Pipeline (GitHub Actions)

Stage Description
Build mvn compile + npm run build
Test mvn verify with Testcontainers (Kafka, PostgreSQL)
Containerize Podman multi-stage builds
Push Images to GitHub Container Registry (ghcr.io)
Deploy Podman Compose deployment
Smoke Test Health check endpoint verification
Security Scan Trivy vulnerability scanning

Observability Stack

  • Prometheus — Metrics collection from /actuator/prometheus
  • Grafana — Pre-configured dashboards for incidents, services, AI analysis
  • Loki — Centralized log aggregation with Promtail
  • Alerts — PrometheusRule alerts → Alertmanager → Webhook → Incident Service

Roadmap

  • Foundation — Multi-module Maven project, shared library, API Gateway
  • Auth Service — JWT authentication, user management
  • Incident Service — Incident CRUD, Kafka events
  • Metrics Service — Prometheus ingestion, Grafana dashboards
  • AI Service — Ollama integration, prompt engineering, structured analysis
  • Integration — End-to-end alert → incident → AI analysis → UI
  • Observability — Loki, Promtail, alert rules
  • Frontend — React dashboard, real-time updates, incident detail

Resume Value

This project demonstrates proficiency in:

  • Java 21 / Spring Boot 4 — Modern backend development
  • Microservices — Service decomposition, API Gateway, inter-service communication
  • Apache Kafka — Event-driven architecture (KRaft mode)
  • AI/ML Integration — Local LLM for incident analysis via Ollama
  • Docker/Podman — Containerization and orchestration
  • CI/CD — GitHub Actions with automated testing and deployment
  • Observability — Prometheus, Grafana, Loki
  • PostgreSQL — Per-service database design, pgvector for embeddings
  • React — Modern frontend with WebSocket real-time updates

License

MIT

About

A platform that monitors microservices, collects logs and metrics, detects failures, and uses a local Ollama LLM (gemma3:1b) to explain incidents and suggest fixes.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages