Files
ophion/README.md
bigtux 6f9657a3a8 feat: Universal auto-instrumentation for all languages
## New Features

### Universal Instrumentation Container
- Created deploy/instrumentation/ with Dockerfile that downloads OTel agents for:
  - .NET (glibc and musl/Alpine versions)
  - Node.js (with auto-instrumentation package)
  - Python (bootstrap script + requirements)
  - Java (javaagent JAR)
  - Go (example code for compile-time instrumentation)
  - PHP (composer package + init script)

### Universal instrument.sh Script
- Auto-detects application language from running processes
- Generates docker-compose snippets for each language
- Supports: dotnet, nodejs, python, java, go, php
- Usage: ./instrument.sh <container> [language] [otlp_endpoint]

### Improved docker-compose.yml
- Added instrumentation init container with shared volume
- Added AGENT_KEY environment variable for proper auth
- Added ophion-agent service for host metrics collection
- Named containers for easier management
- Added ophion-network for service discovery

### Documentation
- Created docs/QUICK_START.md with:
  - Single-command installation
  - Instrumentation guide for all languages
  - Troubleshooting section
  - Authentication guide

### Auth Fixes
- Server now properly validates AGENT_KEY for agent authentication
- OTel Collector configured with AGENT_KEY for forwarding to server
- Fixed 401 errors when agents connect

## Files Changed
- docker-compose.yml: Complete stack with all services
- deploy/instrumentation/*: Universal OTel agent container
- deploy/docker/otel-collector-config.yaml: Fixed auth headers
- instrument.sh: Universal instrumentation script
- docs/QUICK_START.md: Complete quick start guide
- README.md: Updated with new features
- .env.example: Added AGENT_KEY

## Testing
- Go code compiles successfully
- Docker images build correctly
- All changes are backwards compatible
2026-02-06 19:28:43 -03:00

198 lines
6.7 KiB
Markdown

# 🐍 OPHION
**Open Source Observability Platform — AI-Powered Monitoring**
[![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL%203.0-blue.svg)](LICENSE)
[![Go](https://img.shields.io/badge/Go-1.22-00ADD8.svg)](https://golang.org/)
[![Docker](https://img.shields.io/badge/Docker-Compose-2496ED.svg)](https://docs.docker.com/compose/)
---
## O que é o OPHION?
OPHION é uma plataforma de observabilidade que combina **métricas, logs e traces** com **inteligência artificial** para monitoramento proativo de infraestrutura.
### ✨ Diferenciais
| Feature | OPHION | Datadog | Grafana |
|---------|--------|---------|---------|
| Métricas, Logs, Traces | ✅ | ✅ | ✅ |
| **Copilot com IA** | ✅ | ❌ | ❌ |
| **Auto-Healing** | ✅ | ❌ | ❌ |
| **Correlação de Alertas com IA** | ✅ | 💰 | ❌ |
| **Previsões de Capacidade** | ✅ | 💰 | ❌ |
| Open Source | ✅ | ❌ | ✅ |
| **Auto-instrumentação Universal** | ✅ | 💰 | ❌ |
---
## 🚀 Quick Start (1 Comando)
```bash
git clone https://github.com/bigtux/ophion.git && cd ophion && docker compose up -d
```
Aguarde ~2 minutos e acesse:
- **Dashboard:** http://localhost:3000
- **API:** http://localhost:8080
- **OTLP (traces):** localhost:4317 (gRPC) / localhost:4318 (HTTP)
📖 [Guia Completo de Quick Start](docs/QUICK_START.md)
---
## 🔧 Instrumentar Sua Aplicação
### Script Universal
```bash
# Auto-detecta a linguagem
./instrument.sh my-container
# Ou especifique
./instrument.sh my-container nodejs
./instrument.sh my-container python
./instrument.sh my-container java
./instrument.sh my-container dotnet
```
### Linguagens Suportadas
| Linguagem | Método | Complexidade |
|-----------|--------|--------------|
| **.NET** | Auto-instrumentation | 🟢 Zero code |
| **Node.js** | Auto-instrumentation | 🟢 Zero code |
| **Python** | Auto-instrumentation | 🟢 Zero code |
| **Java** | Java Agent | 🟢 Zero code |
| **Go** | SDK (compile-time) | 🟡 Pequenas mudanças |
| **PHP** | SDK | 🟡 Pequenas mudanças |
📖 [Guia de Instrumentação](docs/QUICK_START.md#-2-instrument-your-application)
---
## 📋 Requisitos
| Recurso | Mínimo | Recomendado |
|---------|--------|-------------|
| CPU | 2 cores | 4+ cores |
| RAM | 4 GB | 8+ GB |
| Disco | 20 GB SSD | 100+ GB SSD |
| Docker | 20.10+ | Latest |
| Docker Compose | v2+ | Latest |
---
## 📦 Arquitetura
```
┌─────────────────────────────────────────────────────────────────┐
│ YOUR APPLICATIONS │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Node.js │ │ Python │ │ Java │ │ .NET │ │ Go │ │
│ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │
│ │ │ │ │ │ │
│ └───────────┴───────────┼───────────┴───────────┘ │
│ │ OTLP (4317/4318) │
└───────────────────────────────┼─────────────────────────────────┘
┌───────────────────────────────┼─────────────────────────────────┐
│ OPHION STACK ▼ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ OpenTelemetry Collector │ │
│ │ (process, batch, export) │ │
│ └─────────────────────────┬───────────────────────┘ │
│ │ │
│ ┌────────────────┐ ▼ ┌────────────────┐ │
│ │ Dashboard │◄──► Server ◄──►│ PostgreSQL │ │
│ │ (Next.js) │ (Go API) │ ClickHouse │ │
│ └────────────────┘ │ Redis │ │
│ └────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
```
---
## 🔐 Autenticação
### Para Aplicações (OTLP)
Envie traces para o OpenTelemetry Collector (porta 4317/4318) - sem auth necessário.
### Para API
Use `AGENT_KEY` para agents ou JWT para dashboard:
```bash
# .env
AGENT_KEY=my-secret-key
```
---
## 📦 Estrutura do Projeto
```
ophion/
├── docker-compose.yml # Stack completa
├── instrument.sh # Script de instrumentação
├── cmd/
│ ├── server/ # API Server (Go)
│ └── agent/ # Agent de coleta
├── dashboard/ # Frontend (Next.js)
├── deploy/
│ ├── docker/ # Docker configs
│ └── instrumentation/ # Container com agents OTel
├── internal/ # Código interno Go
└── docs/
├── QUICK_START.md # ⭐ Comece aqui
├── INSTALL.md
└── SECURITY.md
```
---
## 📖 Documentação
- ⭐ [Quick Start](docs/QUICK_START.md) - Comece em 5 minutos
- [Instalação Avançada](docs/INSTALL.md)
- [Segurança](docs/SECURITY.md)
- [Manual Completo](docs/MANUAL_COMPLETO.md)
---
## 🛠️ Desenvolvimento
```bash
# Clonar
git clone https://github.com/bigtux/ophion.git
cd ophion
# Compilar Go
go build ./...
# Rodar localmente
docker compose up -d postgres redis
go run ./cmd/server
# Testes
go test ./...
```
---
## 🆘 Suporte
- **Issues:** https://github.com/bigtux/ophion/issues
- **Email:** suporte@ophion.com.br
---
## 📄 Licença
AGPL-3.0 (Community Edition)
---
<p align="center">
<b>Made with 🖤 in Brazil</b>
</p>