Jaeger Tracing Setup

Comprehensive guide for jaeger tracing setup covering essential concepts, practical examples, and production best practices.

Jaeger tracing is a distributed tracing system that captures the journey of requests across microservices. This page documents the setup of Jaeger in production: installing, configuring, and integrating the Jaeger components to instrument services and visualize latency, errors, and flow across services. It matters when you need to debug a request that spans multiple services, identify bottlenecks in a distributed system, or validate that your service mesh or API gateway is performing as expected.

Deploying Jaeger Components

To run Jaeger, you must deploy its core components: the collector, query service, and storage backend. The collector receives spans, the query service serves traces to clients, and the storage backend persists data. Deployment options include standalone binaries, Kubernetes, and Docker Compose.

Standalone Binary Deployment

The Jaeger binary (jaeger-all-in-one) bundles the collector, query, and UI into a single process. It is suitable for development and small production systems.


./jaeger-all-in-one \
  --reporter.type=grpc \
  --collector.zipkin.host-port=0.0.0.0:9411 \
  --query.address=0.0.0.0:16686 \
  --storage.type=memory \
  --storage.memory.max-traces=100000

The --reporter.type=grpc flag enables gRPC reporting, which is more efficient than HTTP for high-volume tracing. The --collector.zipkin.host-port exposes a Zipkin-compatible endpoint for backward compatibility. The --query.address sets the HTTP port for the query UI and API. --storage.type=memory uses in-memory storage, which is fast but non-persistent.

For production, use --storage.type=elasticsearch and configure Elasticsearch connection:

./jaeger-all-in-one \
  --reporter.type=grpc \
  --collector.zipkin.host-port=0.0.0.0:9411 \
  --query.address=0.0.0.0:16686 \
  --storage.type=elasticsearch \
  --storage.elasticsearch.server-urls=http://es.example.com:9200 \
  --storage.elasticsearch.index-prefix=jaeger \
  --storage.elasticsearch.max-span-age=168h

The --storage.elasticsearch.index-prefix sets the index name prefix. The --storage.elasticsearch.max-span-age sets the retention period for spans. Spans older than this duration are automatically removed from the index.

Kubernetes Deployment with Helm

For larger systems, deploy Jaeger using Helm. The official Jaeger Helm chart is used across teams.

# values.yaml
jaeger:
  allInOne:
    enabled: true
    image: jaegertracing/all-in-one:latest
    resources:
      requests:
        memory: "512Mi"
        cpu: "250m"
      limits:
        memory: "1Gi"
        cpu: "500m"
    env:
      - name: JAEGER_STORAGE
        value: elasticsearch
      - name: JAEGER_STORAGE_ES_SERVER_URLS
        value: "http://elasticsearch-master:9200"
      - name: JAEGER_STORAGE_ES_INDEX_PREFIX
        value: "prod-jaeger"
      - name: JAEGER_STORAGE_ES_MAX_SPAN_AGE
        value: "168h"
    service:
      type: ClusterIP
      port: 16686
    # Expose query UI via Ingress
    ingress:
      enabled: true
      hosts:
        - jaeger.example.com
      annotations:
        kubernetes.io/ingress.class: nginx
        nginx.ingress.kubernetes.io/rewrite-target: /

Apply with:

helm install jaeger jaeger/jaeger -f values.yaml

The allInOne.enabled: true deploys the all-in-one binary. The env section sets environment variables used by Jaeger. The ingress block enables external access to the query UI.

Configuration File

For fine-grained control, use a YAML configuration file:

# jaeger-config.yaml
reporter:
  type: grpc
  grpc:
    bufSize: 10000
    flushInterval: 500ms
    flushMaxSize: 1000
    bufferPoolSize: 100
collector:
  hostPort: "0.0.0.0:6831"
  zipkin:
    hostPort: "0.0.0.0:9411"
  processors:
    - type: batch
      batch:
        batchSize: 1000
        batchMaxSize: 10000
        batchTimeout: 1000ms
  storage:
    type: elasticsearch
    elasticsearch:
      serverURLs: ["http://es.prod:9200"]
      indexPrefix: "jaeger-traces"
      maxSpanAge: "72h"
      numShards: 3
      numReplicas: 1
query:
  address: "0.0.0.0:16686"
  storage:
    type: elasticsearch
    elasticsearch:
      serverURLs: ["http://es.prod:9200"]
      indexPrefix: "jaeger-traces"
      numShards: 3
      numReplicas: 1

This config uses batch processors to group spans before sending to storage. The bufSize, flushInterval, and batchTimeout settings tune the gRPC reporter’s buffer behavior. The numShards and numReplicas optimize Elasticsearch indexing.

Instrumenting Services

To generate traces, services must emit spans. Use the OpenTelemetry SDK or the Jaeger SDK.

OpenTelemetry SDK in Go

package main

import (
	"context"
	"log"
	"net/http"

	"go.opentelemetry.io/otel"
	"go.opentelemetry.io/otel/exporters/jaeger"
	"go.opentelemetry.io/otel/sdk/trace"
)

func main() {
	ctx := context.Background()

	// Create Jaeger exporter
	exporter, err := jaeger.NewExporter(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint("http://jaeger-collector:6831")))
	if err != nil {
		log.Fatal(err)
	}

	// Create trace provider
	tp := trace.NewTracerProvider(
		trace.WithBatcher(exporter),
		trace.WithResource(otel.NewResource(
			otel.Attribute{Key: "service.name", Value: "payment-service"},
			otel.Attribute{Key: "service.version", Value: "v1.2.0"},
		)),
	)

	// Set global trace provider
	otel.SetTracerProvider(tp)

	// Start HTTP server
	http.HandleFunc("/process", func(w http.ResponseWriter, r *http.Request) {
		tr := otel.Tracer("payment-service")

		ctx, span := tr.Start(ctx, "process-payment")
		defer span.End()

		// Simulate work
		span.AddEvent("payment-validated", trace.WithAttributes(
			attribute.String("payment.id", "12345"),
			attribute.Int("amount", 999),
		))

		// Call downstream service
		client := http.Client{}
		req, _ := http.NewRequestWithContext(ctx, "GET", "http://user-service:8080/user/123", nil)
		resp, err := client.Do(req)
		if err != nil {
			span.RecordError(err)
			http.Error(w, "Internal Server Error", http.StatusInternalServerError)
			return
		}
		resp.Body.Close()

		span.AddEvent("user-data-retrieved", trace.WithAttributes(
			attribute.Int("user.id", 123),
			attribute.String("user.name", "Alice"),
		))

		w.WriteHeader(http.StatusOK)
		w.Write([]byte("Payment processed"))
	})

	log.Println("Server listening on :8080")
	log.Fatal(http.ListenAndServe(":8080", nil))
}

The jaeger.WithCollectorEndpoint configures the exporter to send spans to Jaeger’s gRPC collector. The trace.WithBatcher ensures spans are sent in batches. The trace.WithResource adds service metadata to every span.

Instrumenting with Jaeger SDK

For services using the Jaeger SDK directly:

import "github.com/uber/jaeger-client-go"

func main() {
	cfg := &jaeger.Configuration{
		ServiceName: "inventory-service",
		Sampler: &jaeger.SamplerConfig{
			Type:  "probabilistic",
			Param: 0.1,
		},
		Reporter: &jaeger.ReporterConfig{
			BufferFlushInterval: 1000 * time.Millisecond,
			BufferFlushSize:     1000,
			LogSpans:            true,
			CollectorEndpoint:   "http://jaeger-collector:6831",
		},
	}

	tracer, closer, err := cfg.NewTracer()
	if err != nil {
		log.Fatal(err)
	}
	defer closer.Close()

	// Use tracer
	ctx, span := tracer.StartSpan("fetch-items")
	span.LogFields(
		jaeger.LogFields(
			jaeger.String("item.type", "electronics"),
			jaeger.Int64("count", 50),
		),
	)
	defer span.Finish()
}

The SamplerConfig controls which spans are sampled. Type: probabilistic and Param: 0.1 means 10% of spans are recorded. The BufferFlushInterval and BufferFlushSize tune when the reporter flushes spans to the collector.

High Availability and Scalability

For high-throughput systems, separate collector and query services.

Dedicated Collector

Deploy multiple collector instances behind a load balancer:

# collector-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jaeger-collector
spec:
  replicas: 4
  selector:
    matchLabels:
      app: jaeger-collector
  template:
    metadata:
      labels:
        app: jaeger-collector
    spec:
      containers:
        - name: collector
          image: jaegertracing/jaeger-collector:latest
          ports:
            - containerPort: 6831
          env:
            - name: JAEGER_SERVICE_NAME
              value: jaeger-collector
            - name: JAEGER_STORAGE
              value: elasticsearch
            - name: JAEGER_STORAGE_ES_SERVER_URLS
              value: "http://es.prod:9200"
            - name: JAEGER_COLLECTOR_ZIPKIN_HOST_PORT
              value: "0.0.0.0:9411"
            - name: JAEGER_COLLECTOR_PROCESSORS
              value: "batch"
            - name: JAEGER_COLLECTOR_BATCH_BUFFER_FLUSH_INTERVAL
              value: "500ms"
            - name: JAEGER_COLLECTOR_BATCH_BUFFER_FLUSH_SIZE
              value: "500"

The JAEGER_COLLECTOR_PROCESSORS=batch enables batch processing. The JAEGER_COLLECTOR_BATCH_BUFFER_FLUSH_INTERVAL and JAEGER_COLLECTOR_BATCH_BUFFER_FLUSH_SIZE control when the collector flushes batches.

Query Service with Read-Only Replicas

Deploy multiple query services with a shared storage backend:

# query-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jaeger-query
spec:
  replicas: 3
  selector:
    matchLabels:
      app: jaeger-query
  template:
    metadata:
      labels:
        app: jaeger-query
    spec:
      containers:
        - name: query
          image: jaegertracing/jaeger-query:latest
          ports:
            - containerPort: 16686
          env:
            - name: JAEGER_STORAGE
              value: elasticsearch
            - name: JAEGER_STORAGE_ES_SERVER_URLS
              value: "http://es.prod:9200"
            - name: JAEGER_QUERY_ADDRESS
              value: "0.0.0.0:16686"
            - name: JAEGER_QUERY_CACHING
              value: "true"
            - name: JAEGER_QUERY_CACHING_TTL
              value: "15m"

The JAEGER_QUERY_CACHING=true enables caching of query results. JAEGER_QUERY_CACHING_TTL=15m sets the cache lifetime.

Common Failure Modes

Span Loss in High Load

Spans are lost when the collector buffer fills and the collector crashes before flushing. This happens when JAEGER_COLLECTOR_BATCH_BUFFER_FLUSH_INTERVAL is too long and the collector restarts without persistence.

Symptom: Traces show missing spans, especially at peak load.

Fix: Set JAEGER_COLLECTOR_REPORTER_FLUSH_INTERVAL and JAEGER_COLLECTOR_REPORTER_FLUSH_SIZE to ensure timely flushes. Use --storage.type=elasticsearch with --storage.elasticsearch.max-span-age to retain spans across restarts.

Incorrect Service Name Mapping

Spans arrive with service.name field, but the query UI shows multiple services where one is expected.

Cause: The service.name is not consistent across services. One service logs payment-service, another PaymentService.

Fix: Use resource.attributes.service.name in OpenTelemetry, or ensure Jaeger SDK sets ServiceName consistently.

Zipkin-Compatible Endpoint Misuse

The Zipkin endpoint (/api/v2/spans) is used, but spans are not visible in the UI.

Cause: The collector expects gRPC spans but receives HTTP spans. The reporter.type=grpc is missing.

Fix: Use jaeger.WithCollectorEndpoint in OpenTelemetry or set JAEGER_REPORTER_TYPE=grpc in Jaeger SDK.

Traces with Missing Dependencies

The dependency graph is incomplete.

Cause: The JAEGER_COLLECTOR_DEPENDENCY_PROCESSORS is not enabled.

Fix: Enable dependency processors in the collector:

collector:
  processors:
    - type: batch
    - type: dependency

Or set JAEGER_COLLECTOR_DEPENDENCY_PROCESSORS=true.

Connecting to Tracing Tools

Exporting Traces to External Systems

Use the jaeger-client-go to export traces to external systems:

import "github.com/uber/jaeger-client-go/zipkin"

func main() {
	cfg := &jaeger.Configuration{
		ServiceName: "payment-service",
		Reporter: &jaeger.ReporterConfig{
			LogSpans: true,
			CollectorEndpoint: "http://jaeger-collector:6831",
		},
	}

	tracer, closer, err := cfg.NewTracer()
	if err != nil {
		log.Fatal(err)
	}
	defer closer.Close()

	// Export to Zipkin
	zipkinExporter, err := zipkin.NewExporter(
		"http://zipkin:9411/api/v2/spans",
		"payment-service",
		"127.0.0.1:8080",
	)
	if err != nil {
		log.Fatal(err)
	}

	tracer.RegisterExporter(zipkinExporter)
}

Querying Traces via API

The query service exposes a REST API. Use curl to fetch traces:

curl -X GET \
  "http://jaeger-query:16686/api/traces?service=payment-service&start=1672531200000000000&end=1672534800000000000" \
  -H "Accept: application/json" \
  -o traces.json

The start and end timestamps are in nanoseconds since Unix epoch. Use ?limit=100 to paginate results.

Summary

Jaeger tracing setup requires coordinating collector, query, and storage. Use jaeger-all-in-one for quick deployments. For production, separate collector and query services. Instrument services using OpenTelemetry or Jaeger SDK. Tune batchers, samplers, and exporters. Monitor for span loss, inconsistent service names, and dependency graph gaps. The core pattern is: emit spans with structured metadata, send them via gRPC or HTTP, and query them via a REST API. Every element of the system is defined by standard protocols and well-known configuration keys, not by a single vendor’s product.

This page was rewritten on 17 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.