How headcrab/robin2 works
Main Components
a) Frontend Layer:
• Web Interface (located in /web directory)
• Templates Engine (web/templates)
• Static Assets (CSS, JavaScript, Images)
b) Backend Layer:
• API Handlers (internal/app/handlersApi.go, handlersApiV2.go)
• Web Handlers (internal/app/handlersWeb.go)
• Template Handlers (internal/app/handlersTemplate.go)
c) Core Services:
• Data Formatting Service (internal/format)
• Decoding Service (internal/decode)
• Cache Layer (internal/cache)
• Storage Layer (internal/store)
d) External Systems:
• ClickHouse Database
• Redis Cache
• Various SQL Databases (MySQL, MSSQL, Oracle)
[Client Layer]
• ↓ ↑
[Web/API Layer]
• ↓ ↑
[Service Layer]
• ↓ ↑
[Data Layer]
Component Relationships
• HTTP requests from clients to handlers
• Data flow between services
• Storage operations
• Cache interactions
Specific Implementation Details
a) Data Flow:
• Client requests → Middleware (logging, timing) → Handlers
• Handlers → Format Service → Data Store
• Cache interaction points
• Template rendering flow
b) Multiple Storage Options:
• Supported databases
• Primary storage (ClickHouse)
• Cache layer with Redis and in-memory options
c) Format Processors:
• Supported output formats (JSON, XML, HTML, Grafana)
• Format transformation flow
Key Features to Highlight
• Tag data retrieval system
• Template processing engine
• Data grouping and aggregation
• Tag classification system
• Logging system
• Configuration management
Additional Elements
Include:
• System boundaries
• External integration points
• Configuration components
• Deployment containers (based on docker-compose files)
Notes for Implementation
• Use standard UML notation where applicable
• Version information
• Scaling points
• Monitoring/logging points
• Cache boundaries
• Configuration reload paths