Interview Prep/Monitoring & Observability/Tracing, OpenTelemetry and CloudWatch

Only ~1% of traces show up, and the error trace you need is missing

IntermediateTroubleshootingTracing, OpenTelemetry and CloudWatch
Answer

Likely causes → Head sampling (OTEL_TRACES_SAMPLER=parentbased_traceidratio, OTEL_TRACES_SAMPLER_ARG=0.01) decides before the outcome is known.

Diagnose → Check sampler env vars and collector processors.

Fix → Use tail sampling in a collector tier: keep all errors and slow traces, sample the rest:

tail_sampling:
  policies:
    - { name: errors, type: status_code, status_code: { status_codes: [ERROR] } }
    - { name: slow, type: latency, latency: { threshold_ms: 1000 } }
    - { name: rest, type: probabilistic, probabilistic: { sampling_percentage: 5 } }

Route all spans of a trace to the same collector with the loadbalancing exporter (routing_key: traceID).

Prevent → Document sampling so engineers know what is kept.

All Monitoring & Observability questions Roadmap: Logging & tracing

More on Tracing, OpenTelemetry and CloudWatch