Skip to content

jaytrivediSF25/nice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

OpsGraph

Operational intelligence platform that converts Sentry production errors into a knowledge graph, enables reproduction in isolated sandboxes, and provides evidence-based debugging.

✅ Verified: Runs Locally TODAY

This implementation uses REAL integrations - no stubs:

  • ✅ Real Sentry REST API calls
  • ✅ Real Daytona CLI execution (with local fallback)
  • ✅ Real Git cloning and command execution
  • ✅ Real SQLite database storage

Quick Start (5 minutes)

1. Backend Setup

cd backend
pip install -r requirements.txt

Create backend/.env:

# Database
DATABASE_URL=sqlite:///./opsgraph.db

# Sentry (REQUIRED for /events/sentry/pull)
# Get token from: https://sentry.io/settings/account/api/auth-tokens/
# Required scopes: event:read, project:read
SENTRY_AUTH_TOKEN=your_sentry_auth_token_here
SENTRY_ORG_SLUG=your_org_slug
SENTRY_PROJECT_SLUG=your_project_slug
SENTRY_BASE_URL=https://sentry.io/api/0

# Daytona (optional - falls back to local runner if not set)
DAYTONA_ENABLED=false
DAYTONA_CLI=daytona
DAYTONA_STRATEGY=A

# CORS
CORS_ORIGINS=http://localhost:3000

Run backend:

cd backend
uvicorn app.main:app --reload

✅ Backend runs on http://localhost:8000

2. Frontend Setup

cd frontend
npm install

Create frontend/.env.local:

NEXT_PUBLIC_API_BASE=http://localhost:8000

Run frontend:

npm run dev

✅ Frontend runs on http://localhost:3000

3. Verify It Works

  1. Check backend health:

    curl http://localhost:8000/health/details

    Should return integration status.

  2. Open frontend: http://localhost:3000

  3. Test Sentry sync:

    • Click "Sync Sentry" (requires valid tokens)
    • OR click "Seed Demo Incident" (works without Sentry)
  4. View graph: Errors appear as nodes

  5. Reproduce error:

    • Click error node → Click "Reproduce"
    • Enter repo URL and command
    • Watch logs stream in real-time

Getting Sentry Auth Token

  1. Go to https://sentry.io/settings/account/api/auth-tokens/
  2. Click "Create New Token"
  3. Scopes needed: event:read, project:read
  4. Copy token → paste into SENTRY_AUTH_TOKEN in backend/.env

API Endpoints (All Real, No Stubs)

  • GET /health - Basic health check
  • GET /health/details - Integration status (Sentry, Daytona, GitHub)
  • GET /events/sentry/pull?minutes=60&limit=50 - Pulls REAL Sentry issues
  • POST /events/sentry - Ingest single Sentry event
  • GET /graph - Get knowledge graph (nodes + edges from SQLite)
  • GET /graph/summary - Top errors and services
  • POST /simulate/reproduce - Runs REAL command in sandbox
  • GET /simulate/{run_id} - Get run status and logs
  • GET /simulate/{run_id}/logs?tail=4000 - Stream logs
  • GET /audit/recent?limit=50 - Audit trail
  • POST /daytona/verify - Test Daytona CLI

Architecture

Backend:

  • FastAPI + SQLModel + SQLite
  • Real Sentry REST API client (httpx)
  • Real Daytona CLI execution (subprocess)
  • Real local Git execution (fallback)

Frontend:

  • Next.js (App Router) + TypeScript
  • React Flow for graph visualization
  • Tailwind CSS (monochrome dark theme)
  • Real-time log streaming

Data Flow:

  1. Sentry API → Normalize → SQLite
  2. SQLite → Graph API → Frontend
  3. Frontend → Reproduce → Runner → Logs → Frontend

Requirements

Troubleshooting

Backend won't start:

  • Check Python version: python --version
  • Install dependencies: pip install -r requirements.txt
  • Check port 8000 is free

Frontend won't start:

  • Check Node version: node --version
  • Install dependencies: npm install
  • Check port 3000 is free

Sentry sync fails:

  • Verify SENTRY_AUTH_TOKEN is set
  • Verify SENTRY_ORG_SLUG and SENTRY_PROJECT_SLUG are correct
  • Check token has event:read and project:read scopes
  • Error message will show exact fix steps

Reproduce fails:

  • If Daytona enabled: Check daytona --version works
  • Falls back to local runner automatically
  • Check repo URL is accessible (public or authenticated)
  • Check command is valid for the repo

What's Real vs Stub

REAL:

  • Sentry API calls (httpx → sentry.io)
  • Daytona CLI execution (subprocess)
  • Local Git execution (subprocess)
  • SQLite database (persistent storage)
  • Graph visualization (React Flow)
  • Log streaming (real-time polling)

NO STUBS:

  • All integrations are functional
  • All endpoints return real data
  • All commands execute in real environments

Demo Mode

Set NEXT_PUBLIC_DEMO_MODE=true in frontend/.env.local:

  • Pre-fills reproduce modal
  • Shows "Seed Demo Incident" prominently
  • Works without real integrations

See DEMO.md for full demo playbook.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors