Skip to content

Commit ed5a48d

Browse files
committed
feat: scaffold initial core architecture for the OtelContext observability platform, including storage, API, UI, and real-time eventing.
1 parent 0185a43 commit ed5a48d

42 files changed

Lines changed: 443 additions & 233 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.air.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ root = "."
22
tmp_dir = "tmp"
33

44
[build]
5-
cmd = "go build -o ./tmp/argus.exe ."
6-
bin = "./tmp/argus.exe"
5+
cmd = "go build -o ./tmp/OtelContext.exe ."
6+
bin = "./tmp/OtelContext.exe"
77
include_ext = ["go", "tpl", "tmpl", "html"]
88
exclude_dir = ["assets", "tmp", "vendor", "testdata", "web", "test"]
99
include_dir = []
@@ -23,3 +23,4 @@ runner = "green"
2323

2424
[misc]
2525
clean_on_exit = true
26+

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"allow": [
44
"mcp__plugin_context-mode_context-mode__ctx_batch_execute",
55
"mcp__plugin_context-mode_context-mode__ctx_search",
6-
"Read(///wsl.localhost/FedoraDevPod/home/dev/git/Argus/**)",
6+
"Read(///wsl.localhost/FedoraDevPod/home/dev/git/OtelContext/**)",
77
"Read(///wsl.localhost/FedoraDevPod/mnt/**)"
88
]
99
}
1010
}
11+

.env.example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ GRPC_PORT=4317
66
# Database Configuration
77
# Options: mysql, sqlite, sqlserver
88
DB_DRIVER=mysql
9-
DB_DSN=root:admin@tcp(127.0.0.1:3306)/argus?charset=utf8mb4&parseTime=True&loc=Local
9+
DB_DSN=root:admin@tcp(127.0.0.1:3306)/OtelContext?charset=utf8mb4&parseTime=True&loc=Local
1010

1111
# For SQLite:
1212
# DB_DRIVER=sqlite
13-
# DB_DSN=argus.db
13+
# DB_DSN=OtelContext.db
14+

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ go.work.sum
111111

112112
.dev-pids
113113

114-
*argus*.db*
115-
/argus
116-
/argus.exe
114+
*OtelContext*.db*
115+
/OtelContext
116+
/OtelContext.exe
117117

118118
.agent/
119119

@@ -122,4 +122,4 @@ go.work.sum
122122
*.stderr
123123
*scheduled_tasks*
124124
tmp/
125-
data/
125+
data/

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Argus — AI Agent Instructions
1+
# OtelContext — AI Agent Instructions
22

33
## Project Overview
44

5-
Argus is a self-hosted OTLP observability platform. Single Go binary with embedded React frontend.
5+
OtelContext is a self-hosted OTLP observability platform. Single Go binary with embedded React frontend.
66
- **Backend:** Go 1.24, native `net/http` (no frameworks), GORM ORM, gRPC for OTLP ingestion
77
- **Frontend:** React 19 + TypeScript + Mantine UI v8 + ECharts + ReactFlow
88
- **Ports:** gRPC `:4317` (OTLP), HTTP `:8080` (API + WebSocket + UI)
@@ -78,3 +78,4 @@ web/ # React frontend (Vite + Mantine)
7878
test/ # Microservice simulation (7 services)
7979
docs/ # Specifications and plans
8080
```
81+

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
# Project Argus
1+
# OtelContext
22

3-
[![Latest Release](https://img.shields.io/github/v/release/RandomCodeSpace/argus)](https://github.com/RandomCodeSpace/argus/releases)
4-
[![CodeQL](https://github.com/RandomCodeSpace/argus/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/RandomCodeSpace/argus/actions/workflows/github-code-scanning/codeql)
5-
![Go Version](https://img.shields.io/github/go-mod/go-version/RandomCodeSpace/argus)
3+
[![Latest Release](https://img.shields.io/github/v/release/RandomCodeSpace/otelcontext)](https://github.com/RandomCodeSpace/otelcontext/releases)
4+
[![CodeQL](https://github.com/RandomCodeSpace/otelcontext/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/RandomCodeSpace/otelcontext/actions/workflows/github-code-scanning/codeql)
5+
![Go Version](https://img.shields.io/github/go-mod/go-version/RandomCodeSpace/otelcontext)
66
![React](https://img.shields.io/badge/frontend-React%20v18-61dafb?logo=react)
77

8-
Project Argus is an integrated observability and AI analysis platform.
8+
OtelContext is an integrated observability and AI analysis platform.
99

1010
## Getting Started
1111

1212
### Installation
1313
```bash
14-
go install github.com/RandomCodeSpace/argus@latest
14+
go install github.com/RandomCodeSpace/otelcontext@latest
1515
```
1616

1717
### Running
1818
Simply run the binary:
1919
```bash
20-
argus
20+
otelcontext
2121
```
22-
By default, Argus will use an embedded SQLite database (`argus.db`) in the current directory. No configuration is required.
22+
By default, OtelContext will use an embedded SQLite database (`otelcontext.db`) in the current directory. No configuration is required.
2323

2424
### Configuration (Optional)
2525
You can configure the database using environment variables or a `.env` file:
2626

2727
- **MySQL**:
2828
```bash
2929
DB_DRIVER=mysql
30-
DB_DSN=root:password@tcp(localhost:3306)/argus?charset=utf8mb4&parseTime=True&loc=Local
30+
DB_DSN=root:password@tcp(localhost:3306)/otelcontext?charset=utf8mb4&parseTime=True&loc=Local
3131
```
3232
- **SQLite** (Default):
3333
```bash
3434
DB_DRIVER=sqlite
35-
DB_DSN=argus.db
35+
DB_DSN=otelcontext.db
3636
```
3737

3838
## Features
@@ -41,23 +41,25 @@ You can configure the database using environment variables or a `.env` file:
4141
- **Dashboard**: Real-time metrics and traffic analysis.
4242

4343
## OTLP Integration
44-
Argus acts as an OTLP Receiver (gRPC) on port `4317` by default.
44+
OtelContext acts as an OTLP Receiver (gRPC) on port `4317` by default.
4545

4646
### As an OTel Collector Target
47-
You can configure any OpenTelemetry Collector to export data to Argus.
47+
You can configure any OpenTelemetry Collector to export data to OtelContext.
4848

4949
```yaml
5050
exporters:
51-
otlp/argus:
51+
otlp/otelcontext:
5252
endpoint: "localhost:4317"
5353
tls:
5454
insecure: true
5555

5656
service:
5757
pipelines:
5858
traces:
59-
exporters: [otlp/argus]
59+
exporters: [otlp/otelcontext]
6060
logs:
61-
exporters: [otlp/argus]
61+
exporters: [otlp/otelcontext]
6262
```
6363
See `docs/otel-collector-example.yaml` for a full configuration example.
64+
65+

docs/IMPLEMENTATION_PLAN.md

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Argus Observability & Performance Improvement Plan
1+
# OtelContext Observability & Performance Improvement Plan
22

33
## Context
44

5-
Argus is a self-hosted OTLP observability platform (Go backend + React frontend) that ingests traces, logs, and metrics via gRPC, stores them in a relational DB (SQLite/MySQL/PostgreSQL/MSSQL), and serves dashboards via HTTP/WebSocket. When connected to active services pushing continuous telemetry, the DB will grow unbounded and performance will degrade. The goal is to:
5+
OtelContext is a self-hosted OTLP observability platform (Go backend + React frontend) that ingests traces, logs, and metrics via gRPC, stores them in a relational DB (SQLite/MySQL/PostgreSQL/MSSQL), and serves dashboards via HTTP/WebSocket. When connected to active services pushing continuous telemetry, the DB will grow unbounded and performance will degrade. The goal is to:
66

77
1. **Capture all metrics, traces, and logs** — comprehensively but smartly
88
2. **Create an AI-consumable system graph API** — structured JSON that any AI agent can query
99
3. **Maximize performance** — fix identified bottlenecks, use specialized in-memory DBs as accelerators
1010
4. **Hot/cold storage tiering** — keep 7 days hot, archive older data to compressed cold storage
1111
5. **Data compression** — prevent DB blowup from continuous ingestion
12-
6. **HTTP Streamable MCP Server** — universal AI agent access to Argus tools
12+
6. **HTTP Streamable MCP Server** — universal AI agent access to OtelContext tools
1313

1414
### Storage Architecture Principle
1515

@@ -54,7 +54,7 @@ Specialized in-memory/embedded databases are used as **processing accelerators**
5454

5555
### 1.4 TSDB flush channel — visibility + throughput
5656
- **File:** `internal/tsdb/aggregator.go``flush()` (line 114)
57-
- **Fix:** Increase channel cap to 500, add `argus_tsdb_batches_dropped` counter, spawn multiple persistence workers (default 3)
57+
- **Fix:** Increase channel cap to 500, add `OtelContext_tsdb_batches_dropped` counter, spawn multiple persistence workers (default 3)
5858

5959
### 1.5 In-memory TTL cache for dashboard queries
6060
- **New file:** `internal/cache/ttl.go` — simple `sync.Map` with expiry
@@ -123,7 +123,7 @@ data/cold/
123123
- SQLite: `VACUUM`, `PRAGMA optimize`
124124
- PostgreSQL: `VACUUM ANALYZE`
125125
- MySQL: `OPTIMIZE TABLE`
126-
- Track and expose `argus_archive_last_run`, `argus_archive_records_moved`, `argus_hot_db_size_bytes`
126+
- Track and expose `OtelContext_archive_last_run`, `OtelContext_archive_records_moved`, `OtelContext_hot_db_size_bytes`
127127

128128
---
129129

@@ -141,25 +141,25 @@ data/cold/
141141

142142
| Metric | Type | Labels | Purpose |
143143
|--------|------|--------|---------|
144-
| `argus_grpc_requests_total` | CounterVec | method, status | gRPC call counts |
145-
| `argus_grpc_request_duration_seconds` | HistogramVec | method | gRPC latency |
146-
| `argus_grpc_batch_size` | Histogram || Spans/logs per Export call |
147-
| `argus_http_requests_total` | CounterVec | method, path, status | API call counts |
148-
| `argus_http_request_duration_seconds` | HistogramVec | method, path | API latency |
149-
| `argus_tsdb_ingest_total` | Counter || Raw metric points ingested |
150-
| `argus_tsdb_flush_duration_seconds` | Histogram || Flush window time |
151-
| `argus_tsdb_batches_dropped_total` | Counter || Dropped batches |
152-
| `argus_ws_messages_sent_total` | CounterVec | type | WS broadcast count |
153-
| `argus_ws_slow_clients_removed_total` | Counter || Dropped slow clients |
154-
| `argus_dlq_enqueued_total` | Counter || DLQ writes |
155-
| `argus_dlq_replay_success_total` | Counter || Successful replays |
156-
| `argus_dlq_replay_failure_total` | Counter || Failed replays |
157-
| `argus_dlq_disk_bytes` | Gauge || DLQ disk usage |
158-
| `argus_archive_records_moved` | Counter | type | Records archived |
159-
| `argus_hot_db_size_bytes` | Gauge || Hot DB file size |
160-
| `argus_cold_storage_bytes` | Gauge || Cold archive size |
161-
| `argus_go_goroutines` | Gauge || Active goroutines |
162-
| `argus_go_heap_alloc_bytes` | Gauge || Heap memory |
144+
| `OtelContext_grpc_requests_total` | CounterVec | method, status | gRPC call counts |
145+
| `OtelContext_grpc_request_duration_seconds` | HistogramVec | method | gRPC latency |
146+
| `OtelContext_grpc_batch_size` | Histogram || Spans/logs per Export call |
147+
| `OtelContext_http_requests_total` | CounterVec | method, path, status | API call counts |
148+
| `OtelContext_http_request_duration_seconds` | HistogramVec | method, path | API latency |
149+
| `OtelContext_tsdb_ingest_total` | Counter || Raw metric points ingested |
150+
| `OtelContext_tsdb_flush_duration_seconds` | Histogram || Flush window time |
151+
| `OtelContext_tsdb_batches_dropped_total` | Counter || Dropped batches |
152+
| `OtelContext_ws_messages_sent_total` | CounterVec | type | WS broadcast count |
153+
| `OtelContext_ws_slow_clients_removed_total` | Counter || Dropped slow clients |
154+
| `OtelContext_dlq_enqueued_total` | Counter || DLQ writes |
155+
| `OtelContext_dlq_replay_success_total` | Counter || Successful replays |
156+
| `OtelContext_dlq_replay_failure_total` | Counter || Failed replays |
157+
| `OtelContext_dlq_disk_bytes` | Gauge || DLQ disk usage |
158+
| `OtelContext_archive_records_moved` | Counter | type | Records archived |
159+
| `OtelContext_hot_db_size_bytes` | Gauge || Hot DB file size |
160+
| `OtelContext_cold_storage_bytes` | Gauge || Cold archive size |
161+
| `OtelContext_go_goroutines` | Gauge || Active goroutines |
162+
| `OtelContext_go_heap_alloc_bytes` | Gauge || Heap memory |
163163

164164
### 3.2 HTTP metrics middleware
165165
- **New file:** `internal/api/middleware.go`
@@ -168,7 +168,7 @@ data/cold/
168168

169169
### 3.3 gRPC interceptor
170170
- **File:** `main.go` — add `grpc.UnaryInterceptor()` to gRPC server
171-
- Records `argus_grpc_*` metrics per RPC
171+
- Records `OtelContext_grpc_*` metrics per RPC
172172

173173
### 3.4 Runtime metrics goroutine
174174
- **File:** `main.go` — background goroutine sampling `runtime.MemStats` every 15s
@@ -324,7 +324,7 @@ All internal DBs are **embedded** (compiled into the single binary, no external
324324

325325
## Phase 6: HTTP Streamable MCP Server
326326

327-
Expose Argus as an MCP (Model Context Protocol) server over HTTP with SSE streaming, so any AI agent (Claude, GPT, Cursor, etc.) can discover and call Argus tools natively — no custom API integration needed.
327+
Expose OtelContext as an MCP (Model Context Protocol) server over HTTP with SSE streaming, so any AI agent (Claude, GPT, Cursor, etc.) can discover and call OtelContext tools natively — no custom API integration needed.
328328

329329
### 6.1 MCP server package
330330
- **New package:** `internal/mcp/`
@@ -371,7 +371,7 @@ Each tool returns structured content that AI agents can reason over:
371371
{
372372
"type": "resource",
373373
"resource": {
374-
"uri": "argus://system/graph",
374+
"uri": "OtelContext://system/graph",
375375
"mimeType": "application/json",
376376
"text": "{...system graph JSON...}"
377377
}
@@ -387,9 +387,9 @@ Each tool returns structured content that AI agents can reason over:
387387
- **Cache:** MCP tools use the same TTL cache from Phase 1.5
388388

389389
### 6.6 MCP Resources (read-only data subscriptions)
390-
- `argus://system/graph` — live system graph (subscribable)
391-
- `argus://services/{name}/health` — per-service health
392-
- `argus://metrics/prometheus` — current Prometheus metrics dump
390+
- `OtelContext://system/graph` — live system graph (subscribable)
391+
- `OtelContext://services/{name}/health` — per-service health
392+
- `OtelContext://metrics/prometheus` — current Prometheus metrics dump
393393
- AI agents can subscribe to resources for real-time updates via SSE
394394

395395
---
@@ -398,7 +398,7 @@ Each tool returns structured content that AI agents can reason over:
398398

399399
**Changes delivered:**
400400
- `internal/ingest/sampler.go` *(new)* — per-service token bucket sampler; always keeps errors, slow traces, new services; configurable via `SAMPLING_RATE`, `SAMPLING_ALWAYS_ON_ERRORS`, `SAMPLING_LATENCY_THRESHOLD_MS`
401-
- `internal/tsdb/aggregator.go``SetCardinalityLimit(max, onOverflow)` routes excess metric series to overflow bucket; increments `argus_tsdb_cardinality_overflow_total`; wired via `METRIC_MAX_CARDINALITY`
401+
- `internal/tsdb/aggregator.go``SetCardinalityLimit(max, onOverflow)` routes excess metric series to overflow bucket; increments `OtelContext_tsdb_cardinality_overflow_total`; wired via `METRIC_MAX_CARDINALITY`
402402
- `internal/api/ratelimit.go` *(new)* — per-IP token bucket rate limiter; X-Forwarded-For aware; configurable via `API_RATE_LIMIT_RPS`; wraps HTTP handler in `main.go`
403403

404404
## Phase 7: Smart Observability
@@ -413,7 +413,7 @@ Each tool returns structured content that AI agents can reason over:
413413
- **File:** `internal/tsdb/aggregator.go`
414414
- Attribute allowlist: `METRIC_ATTRIBUTE_KEYS=service,method,status_code`
415415
- Max cardinality guard: if `len(buckets)` > 10,000, route to overflow bucket
416-
- Metric: `argus_tsdb_cardinality_overflow_total`
416+
- Metric: `OtelContext_tsdb_cardinality_overflow_total`
417417

418418
### 7.3 DLQ bounded disk + backoff
419419
- **File:** `internal/queue/dlq.go`
@@ -454,5 +454,6 @@ Each tool returns structured content that AI agents can reason over:
454454
2. **Metrics:** Verify all new Prometheus metrics appear at `GET /metrics`
455455
3. **Graph API:** Hit `GET /api/system/graph` during simulation, validate JSON schema
456456
4. **Archival:** Set `HOT_RETENTION_DAYS=0`, trigger archival, verify cold files created and hot DB shrunk
457-
5. **Sampling:** Enable sampling, verify reduced ingestion rate via `argus_ingestion_rate` while errors still captured
457+
5. **Sampling:** Enable sampling, verify reduced ingestion rate via `OtelContext_ingestion_rate` while errors still captured
458458
6. **MCP Server:** `POST /mcp` with `{"jsonrpc":"2.0","method":"initialize",...}` returns tool list; call `tools/call` with `get_system_graph` returns valid graph; connect from Claude Desktop or any MCP client
459+

0 commit comments

Comments
 (0)