Section 7 · Add metrics and traces

The trace each generation links to, the metrics the SDK emits, and what each one lets you do that the conversation alone does not.

Estimated time: 1 min

What metrics and traces add

Each generation links to its OpenTelemetry trace, and the SDK emits metrics you can query in Prometheus. Both are separate from generation data and need an export setup that generation data does not.

What the trace shows

Select the trace link on a generation to open the trace view in Tempo, where you can inspect the full span tree, including:

  • LLM call duration and error status
  • Tool execution spans
  • Nested agent invocations

Each span describes one call, with details such as the model provider, the model name, and token usage. Use the trace to identify latency bottlenecks, understand tool call sequences, and diagnose timeout or error scenarios.

What the metrics show

The SDK emits these OpenTelemetry metrics:

  • LLM call duration
  • Token consumption per call
  • Streaming time to first token
  • Tool calls per generation

If you need custom dashboards, query these metrics in Prometheus.

Note

To compare activity and performance in the agent catalog, set an agent name in your instrumentation and export OpenTelemetry metrics.