1. Sampling #
Keeping the useful traces, not all of them.
Head, tail, adaptive #
| Strategy | Decision | Advantage | Limit |
|---|---|---|---|
| Head (probabilistic) | At the start of the trace, in the SDK | Simple, cheap | Does not know whether the trace will be slow or in error |
| Rate limiting | N traces per second per service | Predictable volume | Same |
| Adaptive (Jaeger) | Rate adjusted per operation based on traffic | Fair coverage of operations | Requires remote sampling |
| Tail | After the trace ends, in a Collector | Keeps all errors and slow traces | Memory, 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 #
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.
| Point | Advice |
|---|---|
| Retention | 7 to 14 days are enough for most diagnostics |
| Elasticsearch indices | One index per day, automatic deletion |
| Volume | Order of magnitude: 1 to 2 KB per stored span; estimate spans/s × size × retention |
| Dependency graph | With 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.yamlSince 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_spans | Spans received |
otelcol_receiver_refused_spans | Spans refused |
otelcol_exporter_send_failed_spans | Write failures to storage |
otelcol_exporter_queue_size | Queue to storage |
Common mistake: Lost spans make traces incomplete (orphan spans) and misleading: alert on export failures.
