LLM observability captures structured telemetry: prompts, completions, token counts, latency, cost, tool calls and the nested trace of an agent's steps. With it you can debug, monitor and evaluate actual behavior.

Observability & tracing (OpenTelemetry GenAI semantics)Diagram with these labels, in reading order: triggers; captures telemetry; feeds into; User Prompt; Model Call Span; Tool Call Span; Telemetry Data; Monitoring Dashboard.triggerscaptures telemetrycaptures telemetryfeeds intoUser PromptModel Call SpanTool Call SpanTelemetry DataMonitoring Dashboard
Telemetry flow in LLM applications

Spans and the GenAI semantic conventions

Each step of a model interaction is captured as a span in a distributed trace: every prompt sent, every completion received and every call to an external tool. The OpenTelemetry GenAI semantic conventions standardize the logged attributes, such as gen_ai.request.model, token counts and operation names. Backends that read OpenTelemetry data, such as Langfuse or Datadog, can then display them. The GenAI conventions are not yet stable, so attribute names can change between releases.

Spans link into a hierarchy. When an agent makes several tool calls for one user request, each call appears as a span branching from the main request span. A slow model call can be traced to the exact span where time was lost, whether in model processing or in an external tool.

Traces can be filtered by criteria such as low-scoring or high-latency runs. You can track latency and cost beside the prompts and completions. If one prompt consistently drives high cost, its spans show whether excessive token use or inefficient tool calls cause it.

Why plain logs cannot answer GenAI questions

In ordinary APM and tracing with tools such as Jaeger or Datadog, each service call is a span and the metrics are response times and error rates. GenAI payloads differ. They are prompts and model outputs, and the key measures are token counts and quality scores. One user request can set off a cascade of model and tool calls, forming a deep tree you must reconstruct to debug.

Plain logs fall short here. When a response is poor, they do not show which prompt version was used, which documents were retrieved or which tool calls ran. Structured tracing shows the relationships between prompts, completions and tool calls, which makes non-deterministic failures across several hops diagnosable. It also explains why a response was generated and what drove its cost and quality.

When to trace, and what to redact

  • Trace any agent, RAG system or multi-step chain in production. Without spans you cannot see which step failed.
  • Standardize on the OpenTelemetry GenAI conventions. The data stays portable across vendors, so you avoid lock-in to one tool's SDK.
  • Redact personally identifiable information (PII) in captured payloads. Prompts and completions captured in the trace can contain personal data, so redaction maintains privacy and compliance.

Example scenario: 2-second latency spikes

Example scenario: latency spikes to 2 seconds on 50% of requests. The figures are illustrative.

Observability & tracing (OpenTelemetry GenAI semantics)Diagram with these labels, in reading order: High Latency Detected; Check Token Count; Check Tool Calls; Check Prompt Complexity; Optimize Token Usage; Refactor Tool Calls; Simplify Prompts.High Latency DetectedCheck Token CountCheck Tool CallsCheck Prompt ComplexityOptimize Token UsageRefactor Tool CallsSimplify Prompts
Debugging latency issues

Uninstrumented segments of the pipeline hide where delays occur. If parts of the processing path emit no spans, you cannot locate the bottleneck. Checks:

  1. Check the latency distribution of recent requests to find outliers.
  2. Examine tracing data for missing spans or segments.
  3. Log token counts and completion times for the most frequently used prompts.

The first step is to instrument every part of the LLM pipeline with OpenTelemetry, which adds a little overhead, and then to optimize the slow span it reveals. Monitor latency metrics and user satisfaction ratings afterward.

With tracing in place you can debug root causes, build dashboards for cost, latency and quality, and collect a stream of failure data to feed future evaluations.

Primary source. Semantic Conventions for Generative AI (GenAI), OpenTelemetry.

Back to the knowledge baseRequest an assessment