Overview
The TraceCtrl Engine is a FastAPI application that:- Runs a background pipeline every 60 seconds to process new spans
- Serves a REST API for the dashboard and external integrations
- Maintains cumulative state in ClickHouse using ReplacingMergeTree tables
Pipeline
The pipeline is scheduled via APScheduler and runs at the interval set byPIPELINE_INTERVAL_SECONDS (default: 60).
Fetch new spans
Reads from
otel_traces where Timestamp > last_watermark. Extracts 20+ attributes per span including all tracectrl.*, openinference.*, and framework-specific fields.Update agent inventory
Groups spans by
tracectrl.agent.id and upserts agent records. Tracks cumulative observation_count, run_count, tools_observed, and computes maturity (LEARNING → MATURE after 10 observations).Build topology
Creates agent-to-agent edges (via
tracectrl.caller.agent_id or parent span resolution) and agent-to-tool edges. Edges carry cumulative counts and confidence levels (LOW → MEDIUM → HIGH).Configuration
| Variable | Default | Description |
|---|---|---|
CLICKHOUSE_HOST | localhost | ClickHouse host |
CLICKHOUSE_PORT | 9000 | ClickHouse native port |
CLICKHOUSE_DB | tracectrl | Database name |
PIPELINE_INTERVAL_SECONDS | 60 | Pipeline cycle interval |
Running Locally
When running locally, ensure ClickHouse is accessible at the configured host/port and the
tracectrl database exists with the schema from config/schema.sql.
