Skip to main content
TraceRoot automatically captures the git repository, commit, and the exact source file and line number for each instrumented function. This powers the Show Code feature in the trace viewer and enables the AI agent to jump directly from a failing trace to the relevant code.

What Gets Captured

AttributeDescription
git_repoRepository in owner/repo format
git_refCommit SHA, tag, or branch name
source_fileFile path of the decorated function
source_lineLine number
source_functionFunction name
git_repo and git_ref are set at the trace level. source_file, source_line, and source_function are set per span automatically by @observe.

Configuration

Git context is auto-detected from your working directory. Override it via environment variables:
TRACEROOT_GIT_REPO=myorg/myrepo
TRACEROOT_GIT_REF=abc123
Or at initialization:
traceroot.initialize(
    git_repo="myorg/myrepo",
    git_ref="abc123",
)

Why It Matters

Source code correlation is what enables the AI agent to perform accurate root cause analysis — it can read the exact function that produced a failing span, not just the trace data. See Root Cause Analysis.