# Traces Browse traces in the UI, read a trace as a tree and a timeline, and inspect the input, output and attributes of each span. Use the trace list to find a request, and the trace view to see what happened inside it. A trace is one request through your application. Each step of it is a span. See the [data model](https://cetra.sh/docs/concepts/data-model/). ## Send a trace Every span you create becomes part of a trace. Spans started inside another span become its children. **Python** ```python import cetra cetra.init() @cetra.observe(kind="tool", name="search_docs") def search_docs(query: str) -> list[str]: return ["doc-1", "doc-2"] @cetra.observe(name="answer") def answer(question: str) -> str: docs = search_docs(question) return f"It is in {docs[0]}." answer("why?") cetra.flush() ``` **TypeScript** ```ts import { flush, init, observe } from "@cetra-ai/sdk"; ``` ```ts init({ apiKey: process.env.CETRA_API_KEY }); const searchDocs = observe(({ query }: { query: string }) => `results for ${query}`, { kind: "tool", name: "search_docs", }); searchDocs({ query: "pricing" }); await flush(); ``` **OpenTelemetry** Any OpenTelemetry instrumentation works. Nested spans form the tree. See [Send OpenTelemetry](https://cetra.sh/docs/get-started/opentelemetry/). ## The trace list Select **Traces** in the sidebar. The list shows the traces of the last 24 hours, newest first. Each row shows: - the status, start time and name of the trace; - a preview of the input and the output; - the duration, token count and cost; - the models used, the session, the user, the tags and the environment; - one column per score name found in the traces. Select a column header to sort by it. The time range picker offers presets from 15 minutes to 30 days and a custom range ([Filters and search](https://cetra.sh/docs/tracing/filters-and-search/)). The list hides evaluation traces and experiment traces until you tick them in the **Include** menu. The button reads **Include · 1** or **Include · 2** when something is ticked. ### The toolbar - **Refresh** reloads the list. Next to it, "Updated N ago" shows how old the data on screen is. When you come back to a list within 15 minutes, it shows the same rows where you left them; a button such as "3 new traces ↑" says what arrived since, and selecting it or **Refresh** loads them. While a new filter or time range loads, the previous rows stay on screen, dimmed. - **Search** finds text in the traces. Press `/` to focus it. - **Columns** opens a chooser where you show or hide columns, move them up or down, or select **Reset**. - The view menu next to the page title in the top bar saves the list's state ([Saved views](https://cetra.sh/docs/tracing/filters-and-search/#saved-views)). - "N loaded" counts the rows loaded so far. - **Filters**, the preset chips and the filter bar are in the row below ([Filters and search](https://cetra.sh/docs/tracing/filters-and-search/)). The line under the table totals the list: the number of traces, how many failed and their cost, over every trace that matches the time range, filter and search, not only the rows loaded so far. Tick rows to total those instead; the line then reads, for example, "3 of 203 selected · 1 error · $0.42". Traces that arrive or change in live mode are counted after **Refresh**. Tick the box of one or more rows to see **Add N to dataset**, which adds those traces to a dataset ([Datasets](https://cetra.sh/docs/evaluation/datasets/)). **Delete matching…** deletes every trace that matches the current filter, search and time range. It shows how many that is before you confirm, and needs the admin role ([Deletion and retention](https://cetra.sh/docs/platform/deletion-and-retention/)). Select a row to open the trace in a panel with the list still in place. Use `j` and `k`, or the arrow keys, to move between rows, and `Esc` to close the panel. The layout switcher in the trace header moves the panel: **Drawer** (the default) opens it beside the list, **Bottom** below the list, and **Page** replaces the list with the trace. **Maximize trace** makes the panel fill the page, and **Restore trace** undoes it. **Open full page** opens the trace on its own page. Turn on the **Live** switch to see new traces arrive as they finish. A button reading "N new traces ↑" shows how many are waiting. Select it to add them to the top of the list. Live mode works on the traces list only. It needs a relative time range (a preset) and the default sort, start time with the newest first. Otherwise the switch is off and its tooltip says why. A project with no traces shows setup snippets until the first trace arrives. ## The trace view The left side shows the spans of the trace. A switch above it picks how: **Tree**, **Timeline** or **Transcript**. Press `t` to cycle through them. - **Tree**: the spans as a tree, with lines from each parent to its children. Each row has the span's name, kind and status, its duration, tokens and cost. Spans with an error are red. Up to three slow spans show their duration in amber: those whose own time, not counting their children, is more than 20% of the trace. There is no time axis. - **Timeline**: the same tree with a bar per span on a shared time axis, in place of the duration, tokens and cost columns. Each bar shows the span's duration and cost, and its tooltip shows the span's own time. The toolbar shows the zoom level. Select **Fit** or press `0` to fit the whole trace. In Tree and Timeline, the toolbar has a search box with **Previous match** and **Next match**, **Errors only**, **Expand all** and **Collapse**, which folds the tree back to its first level. You can also collapse a single branch. **Transcript** shows the model and tool spans in order as one conversation, and has no tree controls. Each model turn shows only the messages that are new since the previous call. Each tool call is one line, `name(arguments) → result · duration`. A failed tool call shows its error in red on that line. Select a line to open its arguments and result. Select **Full width** to show the transcript without the panel beside it. When a trace has just ended, or the list is live, the view updates as spans arrive and shows a **Live** badge with a **Stop** button that stops following. The right side shows the selected span. The header gives its kind, name, model, provider, duration, time to first token, token counts with cache and reasoning, cost and status. The tabs are: - **Chat**: for spans with messages. System instructions are collapsed, messages appear as bubbles, and reasoning is collapsed. Each tool call is one line with its result, and the duration of its tool span when cetra can match it. Select a line to open its arguments and result. Images, audio and PDFs show in place. Tool definitions open in a drawer. - **Input / Output**: the raw payload as a JSON tree, as text or as raw text, with copy buttons. A badge tells you when a value was truncated. - **Attributes**: metadata, attributes, resource attributes, events and links. An exception event shows its stack trace. - **Scores**: the scores on the span and on the trace ([Scores](https://cetra.sh/docs/evaluation/scores/)). - **Annotate**: add your own scores to the trace or the span ([Human annotation](https://cetra.sh/docs/evaluation/annotation/)). The trace header shows the trace's name, its status, the start time, duration, tokens, cost and span count, and links to its session and user. It also shows the environment, release, tags and scores. Its buttons are: - **Run evaluator**: queue an evaluator on the trace, or on the selected span. Members and above can use it ([Evaluators](https://cetra.sh/docs/evaluation/evaluators/)). - **Add to dataset**: save the trace, or the selected span, as a dataset item ([Datasets](https://cetra.sh/docs/evaluation/datasets/)). - **Delete trace**: the trash icon. It needs the admin role ([Deletion and retention](https://cetra.sh/docs/platform/deletion-and-retention/)). - **Copy link**: share the trace with someone who has access to the project. - **Previous trace** and **Next trace**: step through the traces of the list. - **Open full page** and **Close**, when the trace is in a panel. If a span's parent is missing, for example because it was never sent, cetra shows the span as a root of its own, so no span is hidden. ## The spans list Select **Spans** in the sidebar, or press `g` then `p`, to see every span as a row instead of every trace. It has the same toolbar, search, facets, preset chips and saved views as the traces list. Its columns include the kind, name, model, provider, duration, time to first token, tokens and cost. The **LLM** preset keeps only the spans of kind `llm`. Select a row to open its whole trace in the panel, with that span selected. ## Filter traces Use the filter bar and the search box. See [Filters and search](https://cetra.sh/docs/tracing/filters-and-search/). The trace list reads the `traces` view, and the spans list reads the `spans` view. Both are in the [SQL schema](https://cetra.sh/docs/reference/sql-schema/). ## Limits - A span that arrives more than a day in the future, or from before the year 2000, is rejected. - An input or output larger than the server's limit is cut. See [Masking, sampling and truncation](https://cetra.sh/docs/tracing/privacy-controls/). - A time range reaches back no further than your plan allows, and a link to an older trace shows "not found".