An intelligent incident management and quality monitoring system for real-time service health tracking
Tracely is a full-stack application designed to monitor service metrics, detect quality violations through configurable rules, automatically create incidents, and send notifications to teams. Built with Go and Next.js, it provides comprehensive monitoring capabilities for distributed systems.
- π Metrics Management - Collect and analyze time-series metrics (latency, packet loss, error rate, buffer ratio)
- β‘ Real-time Rule Engine - Define quality rules that automatically detect violations and trigger incidents
- π¨ Incident Management - Full lifecycle management (Open β In Progress β Closed) with comments and timeline
- π Smart Notifications - Department-based routing with read/unread status tracking
- π Analytics Dashboard - Elasticsearch-powered analytics with aggregated charts and statistics
- π’ Department Organization - Team-based incident routing and notification management
- π Advanced Filtering - Multi-parameter search across incidents, metrics, and rules
- π± Responsive UI - Modern Next.js frontend with real-time updates
- Outbox Pattern - Reliable event processing with guaranteed delivery
- Worker Architecture - Async processing for rules, notifications, and Elasticsearch sync
- Type-Safe - Full TypeScript frontend and strongly-typed Go backend
- Scalable - PostgreSQL + Elasticsearch for optimal performance
- Developer-Friendly - Comprehensive API, hot reload, and easy setup
- Go 1.24 - High-performance backend
- PostgreSQL 16 - Primary data store
- Elasticsearch 8.11 - Time-series analytics
- sqlc - Type-safe SQL code generation
- Next.js - React framework with TypeScript
- Tailwind CSS v4 - Modern styling
- pnpm - Fast package management
- Docker Compose - Local development environment
- golang-migrate - Database migrations
- Kibana - Data visualization
- Docker & Docker Compose
- Go 1.24+
- Node.js 18+ and pnpm
- Make (optional, for convenience commands)
- Clone the repository
git clone <repository-url>
cd Tracely- Start infrastructure services
make setup
# Or manually:
docker-compose up -d
make db-up # Run migrations- Configure environment
cp .env.example .env
# Edit .env with your configuration- Start the backend
make dev
# Or manually:
go run cmd/server/main.go- Start the frontend
cd web
pnpm install
pnpm dev- Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
- Kibana: http://localhost:5601
make seed-quick # 100 metrics
make seed-medium # 500 metrics
make seed-large # 2000 metrics
make seed-continuous # Continuous generation (for testing)Tracely follows a 3-tier architecture with event-driven workers:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (Next.js/React) β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β HTTP REST API
ββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β Backend API (Go) β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β Handlers β βRepositoryβ β Workers β β
β ββββββββββββ ββββββββββββ ββββββββββββ β
ββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββ΄βββββββββββββ
β β
βββββββββΌβββββββββ ββββββββββΌβββββββββ
β PostgreSQL β β Elasticsearch β
β (Primary DB) β β (Analytics) β
ββββββββββββββββββ βββββββββββββββββββ
Metric Created β Outbox Entry β Rule Worker β Incident Created
β
Notification Worker
β
Notification Sent
β
ES Worker β Analytics
- Services - Monitored systems (e.g., "Superonline", "TV+", "Paycell")
- Metrics - Time-series data with 4 types (latency, packet loss, error rate, buffer ratio)
- Rules - Configurable quality checks (e.g., "latency > 150ms")
- Incidents - Auto-generated when rules are violated
- Notifications - Team alerts with read status tracking
- Departments - Organization units for routing
http://localhost:8080/api
GET /api/services # List all services
GET /api/services/{id} # Get service detailsGET /api/metrics # List metrics (paginated)
POST /api/metrics # Create new metric
GET /api/metrics/chart # Aggregated data for chartsCreate Metric Example:
POST /api/metrics
{
"service_id": "uuid",
"metric_type": "LATENCY_MS",
"value": 145.5,
"recorded_at": "2024-01-15T10:30:00Z"
}GET /api/rules # List rules
POST /api/rules # Create rule
GET /api/rules/{id} # Get rule details
PATCH /api/rules/{id} # Update rule
DELETE /api/rules/{id} # Delete rule
GET /api/rules/stats/top-triggered # Top triggered rulesCreate Rule Example:
POST /api/rules
{
"name": "High Latency Alert",
"description": "Alert when latency exceeds 150ms",
"metric_type": "LATENCY_MS",
"operator": ">",
"threshold": 150,
"severity": "HIGH",
"department_id": "uuid",
"enabled": true
}GET /api/incidents # List incidents (filterable)
GET /api/incidents/{id} # Get incident details
PATCH /api/incidents/{id} # Update incident status
GET /api/incidents/{id}/comments # Get comments
POST /api/incidents/{id}/comments # Add comment
DELETE /api/incidents/{id}/comments/{commentId}
GET /api/incidents/{id}/events # Get incident timelineFilters: ?status=OPEN&severity=HIGH&service_id=uuid&search=keyword
GET /api/notifications # List notifications
POST /api/notifications/{id}/read # Mark as read
POST /api/notifications/{id}/unread # Mark as unread
POST /api/notifications/read-all # Mark all as read
GET /api/notifications/unread-count # Unread countGET /api/departments # List departments
POST /api/departments # Create department
GET /api/departments/{id} # Get department
PUT /api/departments/{id} # Update department
DELETE /api/departments/{id} # Delete departmentAll list endpoints support pagination:
?limit=20&offset=0&sort_by=created_at&sort_dir=desc&search=keyword
Response Format:
{
"data": [...],
"meta": {
"total": 100,
"limit": 20,
"offset": 0
}
}Environment variables (.env):
# Server
PORT=8080
DEBUG=false
CORS_ALLOWED_ORIGINS=http://localhost:3000
# Database
DATABASE_URL=postgres://tracely:tracely@localhost:5432/tracely?sslmode=disable
# Elasticsearch
ELASTICSEARCH_URL=http://localhost:9200
ELASTICSEARCH_INDEX=metricsTracely/
βββ cmd/server/ # Application entry point
βββ internal/ # Core business logic
β βββ config/ # Configuration management
β βββ db/ # Database models (sqlc-generated)
β βββ service/ # Service management
β βββ metric/ # Metrics handling
β βββ rule/ # Rules engine & worker
β βββ incident/ # Incident management
β βββ notification/ # Notification system & worker
β βββ department/ # Department management
β βββ elasticsearch/ # ES integration & worker
β βββ outbox/ # Event outbox pattern
β βββ testutil/ # Test utilities
βββ db/
β βββ migrations/ # SQL migrations
β βββ queries/ # SQL queries for sqlc
β βββ seed.sql # Seed data
βββ web/ # Next.js frontend
β βββ src/
β βββ app/ # Pages (routes)
β βββ components/ # Reusable UI components
β βββ hooks/ # Custom React hooks
β βββ lib/ # API client
βββ scripts/ # Utility scripts
βββ docs/ # Documentation
βββ docker-compose.yml # Docker services
βββ Makefile # Development commands
βββ sqlc.yaml # sqlc configuration
# Infrastructure
make setup # Start Docker + run migrations
make down # Stop all services
make clean # Clean all data
# Database
make db-up # Run migrations
make db-down # Rollback migration
make db-reset # Rollback all + migrate
make db-seed # Seed data
# Development
make dev # Run backend server
make test # Run all tests
make build # Build production binary
# Code Generation
make sqlc # Generate sqlc code
make generate # Run all code generation
# Seeding
make seed-quick # Generate 100 metrics
make seed-medium # Generate 500 metrics
make seed-large # Generate 2000 metricsCreate a new migration:
migrate create -ext sql -dir db/migrations -seq your_migration_name- Write SQL in
db/queries/*.sql - Run
make sqlcto generate Go code - Use generated functions in repositories
# Run all tests
make test
# Run specific package tests
go test ./internal/incident/...
# Run with coverage
go test -cover ./...# Build backend
make build
# Build frontend
cd web
pnpm build# Build images
docker-compose build
# Run in production mode
docker-compose -f docker-compose.prod.yml up -dEnsure these services are configured:
- PostgreSQL 16+
- Elasticsearch 8.11+
- Proper network configuration
- SSL/TLS certificates (for production)
- Dashboard - Overview with metrics, incidents, and rules
- Incidents - List, detail, comments, and timeline
- Metrics - Service metrics with charts
- Rules - Quality rule management
- Notifications - Notification inbox with read tracking
- Services - Service management
- Responsive design
- Real-time updates with refresh indicator
- Multi-select filters
- Pagination controls
- Chart visualizations
- Status badges and icons
Three async workers process events:
- Polls for
METRIC_CREATEDevents - Evaluates metrics against active rules
- Creates incidents when rules are violated
- Runs every 1 second
- Polls for
INCIDENT_CREATEDandINCIDENT_UPDATEDevents - Sends notifications to departments
- Tracks notification delivery
- Extensible for email, Slack, SMS
- Syncs metrics to Elasticsearch
- Maintains time-series data
- Enables fast analytics queries
- Supports dashboard aggregations
LATENCY_MS- Response time in millisecondsPACKET_LOSS- Packet loss percentageERROR_RATE- Error rate percentageBUFFER_RATIO- Buffer ratio
CRITICAL- Requires immediate attentionHIGH- High priorityMEDIUM- Medium priorityLOW- Low priority
OPEN- Newly createdIN_PROGRESS- Being worked onCLOSED- Resolved
>,>=,<,<=,==,!=
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Go best practices and
gofmt - Use TypeScript strict mode
- Write tests for new features
- Update documentation
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Create an issue in the repository
- Check existing documentation in
/docs - Review the API documentation above
- Email/Slack integration for notifications
- Advanced analytics with ML predictions
- Multi-tenant support
- API authentication and authorization
- Webhook support for external integrations
- Mobile app
- Custom dashboard builder
- SLA tracking and reporting
Built with modern technologies and best practices:
- Go for high-performance backend
- Next.js for powerful frontend
- PostgreSQL for reliable data storage
- Elasticsearch for fast analytics
- Outbox pattern for event reliability
Made with β€οΈ for better incident management