Skip to the page

Observability for developers · senior

Logs, traces and the OpenTelemetry Collector

Logs and traces travel through a pipeline that can fall behind or lose data. The OpenTelemetry Collector receives, limits, samples and exports telemetry, and traces show the work inside one slow request.

The notes

What you must know

  • Measure log delay by comparing each event's @timestamp with the time it was indexed (an ingest pipeline can set event.ingested), per service.
  • Late and lost logs: Elasticsearch rejects bulk requests with 429 when overloaded (for example by thousands of small daily shards). The shipper retries, its memory buffer fills, and it pauses reading files. Meanwhile Kubernetes rotates the log files, and lines in rotated files are never read.
  • Fixes: filesystem buffering with a size limit in the shipper (Fluent Bit storage.type filesystem), sensible rotation size, fewer and larger shards, and an alert on shipper lag.
  • A mapping conflict can make one service's logs disappear while others work. Check the indexer errors.
  • OpenTelemetry Collector: receivers (otlp on grpc port 4317 and http port 4318), processors, exporters, wired together in pipelines. Put memory_limiter first so the Collector refuses data before it runs out of memory, and batch last.
  • Tail sampling decides after the whole trace is seen: keep traces with errors, traces slower than a threshold, and a small random percentage of the rest. It needs all spans of one trace on the same Collector instance. Head sampling decides at the start and cannot know if the trace will be slow.
  • Reading a trace: find it from an exemplar on a latency panel, or search by service, attributes and duration. Look at the waterfall: the critical path, gaps between spans, and long runs of similar short spans.
  • 400 near-identical database spans in one trace is an N+1 loop. Fix with one query for all ids. Per-customer problems show in traces and logs, not in metric labels, because metrics for big customers are a tiny share of all requests.

The red pen

Common traps: mistake → fix

  • Mistake: If the logs show nothing, nothing happened

    Fix: The pipeline may be rejecting, buffering or losing lines. Check lag and rotation.

  • Mistake: Sampling 5 percent at random keeps the interesting traces

    Fix: Random head sampling drops most errors. Use tail sampling for errors and slow traces.

  • Mistake: The overall p99 shows a slow customer

    Fix: A small share of requests hides inside the overall percentile. Use traces.

Easy to hard

Questions interviewers ask, easy to hard

  1. Why can logs reach Kibana 40 minutes late, and why do some never arrive?
  2. What are receivers, processors and exporters in the OpenTelemetry Collector?
  3. What is tail sampling and what does it need?
  4. A trace has 400 database spans. What is the problem and how do you fix it?
  5. Write a Collector config that keeps errors, slow traces and 5 percent of the rest.

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview