RousselTMLEARNING

Observability

Jaeger in production: sampling, storage, Kafka and Kubernetes

Make Jaeger reliable and affordable: sampling strategies (head, tail, adaptive), storage sizing, Kafka buffering, deployment on Kubernetes and monitoring.

1. Sampling #

Keeping the useful traces, not all of them.

Head, tail, adaptive #

StrategyDecisionAdvantageLimit
Head (probabilistic)At the start of the trace, in the SDKSimple, cheapDoes not know whether the trace will be slow or in error
Rate limitingN traces per second per servicePredictable volumeSame
Adaptive (Jaeger)Rate adjusted per operation based on trafficFair coverage of operationsRequires remote sampling
TailAfter the trace ends, in a CollectorKeeps all errors and slow tracesMemory, routing by trace_id
# Tail sampling dans un OpenTelemetry Collector placé devant Jaeger
processors:
  tail_sampling:
    decision_wait: 10s
    policies:
      - { name: erreurs, type: status_code, status_code: { status_codes: [ERROR] } }
      - { name: lentes, type: latency, latency: { threshold_ms: 1000 } }
      - { name: echantillon, type: probabilistic, probabilistic: { sampling_percentage: 5 } }
Good practice: Common combination: 100% head sampling in the SDKs, tail sampling in a Collector that keeps 100% of errors and slow traces and 5% of the rest.

2. Storing and absorbing peaks #

Kafka as a buffer.

Architecture with Kafka #

Jaeger architecture with Kafka between collection and storage

At high volume, Kafka is placed between reception and storage: collectors write to Kafka, and ingesters read Kafka and write to Elasticsearch or Cassandra at their own pace. Slow storage no longer causes spans to be lost.

PointAdvice
Retention7 to 14 days are enough for most diagnostics
Elasticsearch indicesOne index per day, automatic deletion
VolumeOrder of magnitude: 1 to 2 KB per stored span; estimate spans/s × size × retention
Dependency graphWith Elasticsearch or Cassandra, a job (spark-dependencies) computes it periodically

3. Kubernetes and monitoring #

Deploying and watching.

Deploying #

helm repo add jaegertracing https://jaegertracing.github.io/helm-charts
helm install jaeger jaegertracing/jaeger -n tracing --create-namespace -f values.yaml

Since Jaeger v2 is an OpenTelemetry Collector, it can also be deployed by the OpenTelemetry Operator (OpenTelemetryCollector resource with the Jaeger image). Put collectors and query services in separate deployments to size them independently.

Monitoring #

Metric (port 8888)Meaning
otelcol_receiver_accepted_spansSpans received
otelcol_receiver_refused_spansSpans refused
otelcol_exporter_send_failed_spansWrite failures to storage
otelcol_exporter_queue_sizeQueue to storage
Common mistake: Lost spans make traces incomplete (orphan spans) and misleading: alert on export failures.

Related articles

Distributed tracing with Jaeger: concepts and architecture

The concepts of distributed tracing (trace, span, context, propagation) and Jaeger: its history, its v2 archi…

Installing Jaeger v2: all-in-one, configuration and storage

Run Jaeger v2 as all-in-one, understand its configuration file (jaeger_storage and jaeger_query extensions, O…

Instrumenting applications for Jaeger with OpenTelemetry

Send traces to Jaeger with OpenTelemetry: auto-instrumentation (Java, Python, Node.js), SDK and manual spans,…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!