Hands-on guide
Trace an Orca workspace with Jaeger and eBPF.
Capture Claude Code and Codex CLI activity, trace a command across workspaces, and profile the Linux process that held up a run.
When a benchmark holds up three agents, I want to know whether to make the benchmark faster, stop another tool competing with it, or send fewer requests to the model. This walkthrough gives me three measurements for that decision: the agent timeline in Jaeger, CPU time for a command, and sampled stacks from the machine that ran it.
You can try the first trace with Docker and Python 3 on macOS or Linux. For eBPF, use a Linux execution host where you can run BCC. The agent instructions below target the Claude Code and Codex CLIs in an Orca worktree terminal. A fresh terminal in another worktree is a separate process tree. Orca worktrees and terminals (opens new window).
# 1. Get one trace into Jaeger
Start Jaeger on the machine where the agent runs. This local instance keeps traces in memory until you stop the container. Jaeger getting started (opens new window).
docker run -d --rm --name orca-jaeger \
-p 127.0.0.1:16686:16686 -p 127.0.0.1:4318:4318 \
cr.jaegertracing.io/jaegertracing/jaeger:2.23.0
Open a terminal in your Orca worktree. Inside an Orca-managed shell, orca terminal create --worktree current --focus opens one. If you run a development checkout of Orca, use its orca-dev CLI for that command. The following commands assume a POSIX-style shell. Download the Python command wrapper and create a fresh run ID. Keep the local .codeperf/ directory out of commits. Download the wrapper.
mkdir -p .codeperf
curl -fsSLo .codeperf/trace-tool.py https://blog.codeperf.io/tracing-tools/trace-tool.py
export CODEPERF_RUN="$(python3 -c 'import uuid; print(uuid.uuid4().hex)')"
export CODEPERF_WORKSPACE="$(basename "$PWD")"
export CODEPERF_TRACE_FILE="$PWD/.codeperf/$CODEPERF_RUN.jsonl"
python3 .codeperf/trace-tool.py --agent lead --name dispatch -- \
python3 .codeperf/trace-tool.py --agent worker --name python-version -- python3 --version
Open Jaeger at http://127.0.0.1:16686, select service orca-tools, and click Find Traces. Open dispatch and expand python-version. You should see two spans in one trace. The child has a PID, exit code, workspace, agent and CPU times. You can also load the JSONL file into the workspace viewer. The wrapper records operation labels and executable names. It leaves command arguments, output and prompts out of its spans.
# 2. Start the agent and trace a real tool
Use the same terminal for the agent you want to measure. Give each agent session a fresh run ID and file. Set the wrapper to file-only mode. This works when a sandboxed command can write to the worktree but cannot send HTTP to the host. The agent's native exporter can still send spans directly to Jaeger.
export CODEPERF_RUN="$(python3 -c 'import uuid; print(uuid.uuid4().hex)')"
export CODEPERF_TRACE_FILE="$PWD/.codeperf/$CODEPERF_RUN.jsonl"
export CODEPERF_TRACE_ENDPOINT=''
Claude Code. Enable its beta trace exporter for this invocation. Jaeger should list service claude-code after the first turn. Expand an interaction to see the model requests and tool executions. Claude Code monitoring and trace settings (opens new window).
export CODEPERF_AGENT=claude
CLAUDE_CODE_ENABLE_TELEMETRY=1 CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1 \
OTEL_TRACES_EXPORTER=otlp OTEL_LOGS_EXPORTER=none OTEL_METRICS_EXPORTER=none \
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://127.0.0.1:4318/v1/traces \
OTEL_RESOURCE_ATTRIBUTES="codeperf.run=$CODEPERF_RUN,workspace.name=$CODEPERF_WORKSPACE" \
python3 .codeperf/trace-tool.py --name claude-session -- claude
Codex CLI. Pass the exporter and run label on the command line for this invocation. Select the Codex service in Jaeger after a turn finishes. In my noninteractive check it was codex_exec. Codex configuration reference (opens new window).
export CODEPERF_AGENT=codex
python3 .codeperf/trace-tool.py --name codex-session -- codex \
-c 'otel.trace_exporter={otlp-http={endpoint="http://127.0.0.1:4318/v1/traces",protocol="binary"}}' \
-c "otel.span_attributes={'codeperf.run'='$CODEPERF_RUN','gen_ai.agent.name'='codex'}"
For a first turn, ask either agent to run this exact command in the worktree and report its exit status. Then replace python3 --version with the benchmark, compiler or test binary you care about and give it a recognizable operation name.
python3 .codeperf/trace-tool.py --name check-python -- python3 --version
Exit the agent to close the session span. From the regular worktree terminal, send the file-only batches to Jaeger.
while IFS= read -r batch; do
printf '%s' "$batch" | curl -fsS -H 'Content-Type: application/json' \
--data-binary @- http://127.0.0.1:4318/v1/traces || break
done < "$CODEPERF_TRACE_FILE"
In Jaeger, filter by the tag codeperf.run=<your run ID> and select the service you want. The native timeline answers “was this turn waiting on a model request or a tool?” The orca-tools span for check-python identifies the process you can profile. When I launched each CLI through the wrapper, its native activity and the measured command shared a trace ID. For both CLIs the command’s direct parent was the session wrapper. To match it to the native tool execution, use its time window and operation name. If another launch path starts a separate trace, the run label lets you find both.
A second worktree or offloaded host. At dispatch time, copy the full 00-…-…-01 context printed by the live parent wrapper. In the worker's terminal, repeat the download, set the same CODEPERF_RUN, choose a local JSONL file, and pass that context explicitly:
python3 .codeperf/trace-tool.py --parent "$PARENT_CONTEXT" \
--workspace bench-worker --agent benchmarker --name hash-4k -- \
openssl speed -seconds 30 -bytes 4096 -evp sha256
Set PARENT_CONTEXT to the copied value before running the command. A child started this way appears beneath the dispatching span even across worktrees. Tag an independent run separately. On a remote Linux host, keep clocks synchronized and run Jaeger there or forward its ports. For example, with Jaeger on the home server, run ssh -N -L 16686:127.0.0.1:16686 -L 4318:127.0.0.1:4318 home-server on a laptop with those ports free. Both hosts can then export to their own loopback address.
# 3. Profile the tool that delayed the run
Expand the turn that finished last. Find the tool that the next dependent operation waited for. Open its orca-tools span and compare wall time with codeperf.cpu.user_s plus codeperf.cpu.system_s. Those counters include the command and descendants it waited for. Nested spans can include the same CPU time. A tool using 18 CPU-seconds in 18 seconds occupied roughly one core on average.
On the Linux host running the tool, install BCC. On Ubuntu with a distribution kernel:
sudo apt-get install bpfcc-tools "linux-headers-$(uname -r)"
Rerun the suspect command as your usual user. For a known CPU-heavy smoke test, run:
python3 .codeperf/trace-tool.py --name hash-4k -- \
openssl speed -seconds 30 -bytes 4096 -evp sha256
The wrapper immediately prints pid=… traceparent=…. In a second Linux terminal on the same host and in the same PID namespace, set pid and context from that line while the process is still alive. Save the profile under the complete context so you can match the capture to this exact invocation. The middle 32 hex digits are the Jaeger trace ID.
read -r pid context # type the numeric PID, a space, and the full traceparent
ps -p "$pid" -o pid,comm
sudo profile-bpfcc -F 49 -p "$pid" -f 5 > "cpu-$context.folded"
awk '{print $NF, $0}' "cpu-$context.folded" | sort -nr | head
Each line ends in a sample count. In my Linux smoke test, Jaeger recorded 18.0 seconds of child CPU for an 18-second OpenSSL run. A five-second capture within that run showed EVP_Digest → SHA256_Update in the OpenSSL process. That is a working join from a timed command to a hot stack. For your own binary, install debug symbols or build with frame pointers if unresolved frames hide the useful part. A PID filter covers that process's threads. For a build that forks compilers, wrap the compiler you want to inspect. A tool too short for attachment needs a repeatable longer batch or collection started before dispatch. BCC installation (opens new window) · CPU profiler examples (opens new window).
# 4. Decide what to change
| What the run shows | Next measurement or change |
|---|---|
| The critical tool keeps a core busy and one stack dominates. | Check its input and call count. For a digest stack, see whether several agents hash the same unchanged artifact. Try reusing one digest and verify the resulting value. |
| A tool takes 20 seconds but consumes little CPU. | On another live run, capture wait sites with sudo offcputime-bpfcc -p "$pid" -f 5 > "wait-$context.folded". The counts are accumulated off-CPU microseconds, which can include runnable delay. A wait site identifies where to investigate I/O, locks or a child process. |
| The benchmark slows down only while another workspace is busy. | Run the same benchmark with and without the overlapping search or build. Check /proc/pressure/cpu and /proc/pressure/io during both runs. These are host-wide signals. Use the controlled rerun to test which tool contributed. |
| Model requests account for most of the delay. | Compare request count, repeated turns and time waiting for the response. A local CPU profile only describes local work. |
Keep the input, tool versions and host fixed. Alternate baseline and changed runs, then compare the tool span, the time until the lead agent receives the result, and output correctness. An interactive session span includes time spent waiting for you to type. Use a single turn or a scripted task for the end-to-end comparison. Off-CPU profiling examples (opens new window) · Linux pressure metrics (opens new window).
I checked native trace export with Claude Code 2.1.333 and Codex CLI 0.172.0 using local model-response fixtures, and checked a targeted on-CPU BCC capture on Linux. The optional off-CPU command needs scheduler kprobe access. My test container did not expose the kprobe debug filesystem, so I could verify only the on-CPU capture there. Automatic attribution of forked process trees and shared daemons across workspaces is still part of the profiler proposal. Stop the temporary backend with docker stop orca-jaeger after saving the traces you need.