# Debug Logs & Traces

A cost spike on a dashboard, a slow response a customer complained about, an agent workflow that didn't finish - in each case the question is the same: what actually happened, and where did it go wrong? Without structured transaction data, answering that means stitching together provider logs, application traces, and cost reports that were never designed to talk to each other. By the time you've reconstructed the picture, the same problem has already run hundreds of times more.

Revenium captures every AI transaction with full financial and attribution context attached. The logs and trace views are where you stop guessing and start knowing - which call was expensive, which workflow it belonged to, which customer triggered it, and where in a multi-step run things went off track.

### <i class="fa-list-ul">:list-ul:</i> Transaction Logs as a Single Source of Truth

The log in **Data > Logs** records every AI call that has flowed through Revenium, with cost, model, duration, and attribution all visible in the same row. There's no separate system for "what it cost" and "who ran it" - they're the same record, queryable in real time with auto-refresh on.

Filters at the top let you narrow by time window, metric type, or any column you've added through Manage Columns. The **Include coding assistants** toggle separates AI development tool traffic - things like Claude Code - from your application's own AI workloads, which matters more than it sounds. Coding assistants generate a high volume of transactions and can dominate the log if you're trying to isolate something else.

Beyond standard LLM completions, the same view also covers:

* **Product Transactions** : usage events that generate line items for billing (either to your customers, or for cross-charging AI usage to other business units)
* **System** : platform-level activity
* **Tool Registry** : cost-generating external tools called by agents (i.e. usage-based APIs like Firecrawl or third-party services like Stripe Identity)
* **Exports** : downloadable data for finance or analytics workflows

Every row links straight into the transaction detail, so moving from "this looks abnormal" to "here's exactly why" never requires leaving the page.

### <i class="fa-rectangle">:rectangle:</i> Everything Revenium Knows About a Single Transaction

Open the detail panel on any row and Revenium shows you the full record of what happened on that one call. This is the layer beneath your dashboard - useful when an aggregated metric raises a question that only the underlying data can answer.

The detail covers:

* **Token usage** broken down across input, output, reasoning, cached, and cache creation - so you can see whether the cost was driven by prompt size, response length, or whether cached context is being reused efficiently
* **Cost** split between input and output rather than shown as a blended figure, which makes it obvious what was actually expensive
* **Timing** across every phase of the call - request time, time to first token, full duration, tokens per second - which lets you tell apart a slow model from a slow network from a slow upstream prompt chain
* **Attribution** to the organization, subscriber, product, agent, and squad responsible - so cost ownership is immediate rather than reconstructed after the fact

If a call is missing attribution data, that itself is useful information. It tells you the workflow that triggered it isn't fully instrumented, and the fix is to update the metering payload to include the missing identifiers.

From the detail panel, **Open full trace view** drops you into the workflow this transaction belonged to.

### <i class="fa-arrow-right">:arrow-right:</i> Seeing How a Workflow Actually Ran

Individual transactions are the atomic unit, but problems usually live at the workflow level. An agent run that lasted hours and cost tens of dollars isn't explained by any single call - it's explained by the sequence of calls, the agents involved, and which steps consumed the most time and money.

The Trace view assembles that sequence. The summary header gives you the headline figures for the run - total cost, total duration, transaction count, success/error ratio, and the models, providers, and task types involved. Below that, two visualisations show the workflow from different angles:

* **The Transaction Timeline** is a Gantt chart of every transaction in the trace, sequenced chronologically and color-coded by agent. Each bar shows the duration and cost of that step. In multi-agent runs the timeline makes handoffs and bottlenecks immediately visible - which agent ran when, which step took longest, which one cost the most - without having to do any arithmetic.
* **The Dependency Tree** shows the structural pattern of the run - sequential, parallel, multi-root - and the cost and duration of each branch. This is the right view when you need to know whether the cost is concentrated in one agent or genuinely distributed across the workflow, because the answer changes what you fix.

Aggregated breakdowns sit beneath both, summarizing cost by model, cost by provider, the input/output token ratio, and time spent by task type - all scoped to this single trace, not your account-wide averages.

### <i class="fa-bug">:bug:</i> Where to Start When Something Goes Wrong

Investigations almost always run broad-to-narrow. Start in the transaction log, filter by whatever you know about the problem - the subscriber who complained, the time window of the spike, the trace type that's been flagged - and look for the rows that stand out on cost or duration. Open the transaction detail to confirm what you're looking at, then follow the trace link to see the workflow context around it.

The pattern that tends to emerge is that expensive or slow traces aren't random. The same trace type, the same agent, or the same task type appears repeatedly at the top of the cost distribution. When that's the case, the fix is almost always in the prompt or workflow logic for that specific path - not in the infrastructure, and not in the model choice. The role of the logs and traces is to get you to that conclusion in minutes rather than hours.

> **Through MCP, conversationally.** The cost-investigation work this page describes is also accessible to an AI assistant connected to Revenium via the MCP Server. Instead of clicking through filters, you describe the problem in natural language. Ask "why did my costs spike yesterday?", "which customer drove the increase this week?", or "is one model accounting for most of the unusual spend?" and the agent breaks the data down across providers, models, customers, agents, or API keys, and explains what it finds. Useful when the question is exploratory rather than known.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.revenium.io/optimize-performance/debug-logs-and-traces.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
