Inferensys

Glossary

Distributed Tracing

Distributed tracing is a method of observing and profiling requests as they flow through a distributed system, capturing timing data and metadata to diagnose performance issues and understand service dependencies.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
LLM OBSERVABILITY

What is Distributed Tracing?

Distributed tracing is a core observability method for tracking requests across microservices and LLM pipelines.

Distributed tracing is a method for profiling and debugging requests as they propagate through a distributed system, such as a microservices architecture or an LLM inference pipeline. It instruments services to generate unique, correlated trace identifiers, capturing detailed timing data and metadata for each operation, known as a span. This creates a complete end-to-end visualization of a request's journey, enabling engineers to pinpoint the root cause of latency, errors, and bottlenecks across interdependent components.

In the context of LLM deployment and serving, distributed tracing is critical for monitoring complex workflows involving model inference, vector database retrievals, and external API calls. By instrumenting frameworks like vLLM or Text Generation Inference (TGI), teams can observe token generation latency, KV cache efficiency, and downstream dependencies. This data feeds into Service Level Objectives (SLOs) and is essential for agentic observability, providing the deterministic telemetry needed to audit autonomous behavior and ensure reliable performance in production environments.

DISTRIBUTED TRACING

Key Components of a Trace

A distributed trace is a directed acyclic graph (DAG) of causally related operations. It is constructed from discrete, timestamped data points called spans, which are linked to form a complete picture of a request's journey.

01

Span

A span is the fundamental unit of work in a trace, representing a single, named operation within a service. It contains:

  • Start and End Timestamps for latency calculation.
  • A Span Name (e.g., handle_llm_request).
  • A unique Span ID.
  • Attributes (key-value pairs) for contextual metadata like model.name="gpt-4" or user.id=12345.
  • Span Kind (Client, Server, Producer, Consumer, Internal).
  • Status (Ok, Error).
  • Links to causally related spans in other traces.
02

Trace

A trace is the complete end-to-end record of a transaction, comprised of a tree of spans. It is defined by:

  • A globally unique Trace ID, propagated across all services involved in the request.
  • A hierarchical parent-child relationship between spans, showing the flow of execution.
  • The Root Span, which has no parent and represents the initial request (e.g., an API call to /chat).
  • In LLM serving, a single trace can encapsulate the entire pipeline: user prompt ingestion, retrieval from a vector database, LLM inference, and final response streaming.
03

Context Propagation

Context Propagation is the mechanism that carries the trace context (Trace ID, Span ID, and other metadata) across service and process boundaries. This is essential for correlating spans into a coherent trace.

  • W3C TraceContext is the modern standard, using HTTP headers like traceparent and tracestate.
  • In asynchronous or message-based systems (e.g., Kafka, RabbitMQ), the context is injected into message headers.
  • For LLMs, propagation ensures a user query's trace can follow the request through API gateways, orchestration layers, multiple model calls, and downstream tool executions.
04

Attributes & Events

Attributes (or Tags) are key-value pairs attached to spans that provide searchable, filterable context about the operation.

  • Examples: llm.model.vendor="openai", retrieval.top_k=5, response.token_count=1500, error.type="rate_limit".

Events (or Annotations) are timestamped logs within a span that mark a specific moment.

  • Examples: "cache.hit", "generation.started", "function.called: calculate_risk", "exception thrown" with a stack trace.
  • These are critical for debugging the precise timing and cause of issues within a long-running LLM inference.
05

Instrumentation

Instrumentation is the code added to an application to create spans, add attributes, and propagate context. It can be:

  • Automatic: Using vendor agents or frameworks (e.g., OpenTelemetry instrumentation for Python's requests library) that inject tracing without code changes.
  • Manual: Developers explicitly define span boundaries and attributes in business logic for maximum control and detail.
  • For LLM frameworks (LangChain, LlamaIndex), instrumentation captures the execution of chains, agents, and tool calls, turning a black-box workflow into an observable graph.
06

Collector & Backend

The Collector is a critical intermediary service that receives, processes, batches, and exports telemetry data (spans) from instrumented applications.

  • It can perform filtering, sampling, and data enrichment.
  • It exports data to one or more Backends for storage and analysis.

Backend systems are where traces are stored, indexed, and visualized.

  • Examples: Jaeger, Zipkin, commercial APM tools (Datadog, New Relic), or specialized LLM observability platforms.
  • Here, engineers query traces, analyze service dependencies, create latency histograms, and set alerts based on trace data.
PROTOCOL & VENDOR COMPARISON

Key Tools and Standards

Comparison of major open-source and commercial distributed tracing systems, focusing on core features relevant to LLM deployment and serving.

Feature / MetricOpenTelemetryJaegerDatadog APMDynatrace

Primary Architecture

Vendor-neutral APIs, SDKs, and collector

End-to-end tracer & UI (CNCF project)

Commercial SaaS platform

Commercial AI-powered SaaS platform

Data Collection Protocol

OTLP (gRPC/HTTP)

Jaeger's own protocols (Thrift/gRPC)

Datadog Agent & proprietary protocol

OneAgent & proprietary protocol

Context Propagation Standards

W3C Trace Context, B3

Jaeger (supports W3C/B3)

Datadog (proprietary, supports B3)

Dynatrace (proprietary, supports W3C)

Auto-Instrumentation for LLM Frameworks

LLM-Specific Spans (e.g., token counts, model latency)

Custom instrumentation required

Custom instrumentation required

Native Integration with Prometheus/Grafana

Tail-Based Sampling Support

Typical Hosting Cost for High Volume

Self-hosted / Variable

Self-hosted / Variable

$31-50 per host/month

$69-100 per host/month

DISTRIBUTED TRACING

Frequently Asked Questions

Distributed tracing is essential for understanding the flow of requests through complex, microservices-based applications, especially when serving large language models. These questions address its core concepts, implementation, and value in an LLMOps context.

Distributed tracing is a diagnostic technique that tracks a single user request as it propagates through a distributed system of interconnected services, capturing timing data and contextual metadata to form a complete end-to-end profile. It works by instrumenting services to generate and propagate unique identifiers: a Trace ID links all operations belonging to the initial request, while Span IDs represent individual units of work within a service. As a request moves from a user interface to a model serving endpoint, through authentication, retrieval-augmented generation (RAG) lookups, and finally the LLM inference itself, each step creates a span with timing, metadata (like model name or prompt hash), and any errors. These spans are collected by a tracing backend (e.g., Jaeger, Tempo) and assembled into a visual trace, revealing the request's path, latency bottlenecks, and failure points.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.