System Overview
TraceCtrl has four components: the Python SDK (in your agent), the OTel Collector (span routing), the Intelligence Engine (processing + API), and the Dashboard (visualization).
Component Details
Python SDK
The SDK wraps OpenInference framework instrumentors with aTraceCtrlSpanProcessor that enriches every span with security attributes. It uses OpenTelemetry as the transport — no custom protocols, no vendor lock-in.
Key modules:
tracectrl.config—configure()sets up the TracerProvider with OTLP gRPC exportertracectrl.processor—TraceCtrlSpanProcessoradds agent identity, tool categories, session IDstracectrl.inference— Classifies tools into 8 risk categoriestracectrl.session— Session ID management via Pythoncontextvarstracectrl.context— W3C traceparent propagation for cross-service agents
OTel Collector
A standard OpenTelemetry Collector configured to receive OTLP spans on gRPC (:4317) and HTTP (:4318), then export them to ClickHouse via the clickhouseexporter. Configuration lives in config/otel-collector.yaml.
Intelligence Engine
A FastAPI application that:- Runs a pipeline every 60 seconds — reads new spans from
otel_traces, upserts the agent inventory, builds topology edges, and advances the watermark - Serves a REST API — topology graph, agent details, session list, span trees
- Uses ClickHouse
ReplacingMergeTreetables with cumulative state (observation counts, call counts, confidence levels)
Dashboard
A React + Vite + TypeScript SPA with:- Topology — Cytoscape.js graph with dagre layout showing agents, tools, and their connections
- Sessions — Trace explorer with span trees and waterfall timelines
- Risk Dashboard — CISO risk view (Sprint 2)
- Attack Paths — Ranked exploitation chains (Sprint 2)
Data Pipeline
ClickHouse Tables
| Table | Engine | Purpose |
|---|---|---|
otel_traces | Auto-created by Collector | Raw OpenTelemetry spans |
agent_inventory | ReplacingMergeTree | Deduplicated agent records |
topology_agent_edges | ReplacingMergeTree | Agent-to-agent connections |
topology_tool_edges | ReplacingMergeTree | Agent-to-tool connections |
pipeline_state | ReplacingMergeTree | Watermark tracking |
ReplacingMergeTree deduplicates rows during background merges. Always query with
FINAL for correct results: SELECT * FROM agent_inventory FINAL.
