OpenTelemetry is the vendor-neutral standard for producing traces, metrics, and logs: SDKs and auto-instrumentation in each service, a wire protocol (OTLP), and the Collector, a pipeline that receives, processes, and exports telemetry. Getting it to work on one laptop is easy; running it for a platform means context that survives every hop, collectors that enrich and sample without falling over, and queues that ride out a backend outage. This lesson follows one span from the line of code that starts it to the trace view, and shows the two failures that matter most: broken traces and lost data.
Difficulty: Advanced · Know this first: Lesson 163, Lesson 160
This bar splits the time from a span ending in the service to its being queryable, in seconds. It is a worked example, not a measurement. Batching and the tail-sampling wait are deliberate; the export hop grows when the backend is down.
Set the span rate through the gateway, its sending queue capacity, and how long the backend is down. Whatever does not fit in the queue is dropped.
seconds of buffer = capacity ÷ rate · dropped = max(0, rate × outage − capacity) · a persistent queue on disk can be far larger than one in memory
Losing data: the queue fills before the backend returns
Three questions. No score is saved anywhere — this is just you against the material.
OpenTelemetry grows in four levels: first instrumenting a service, then propagation and the collector, then sampling and resilience, and finally running it as a platform.
At the basic level you get one service producing traces.
OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=dev.http://localhost:4318 (OTLP over HTTP) or 4317 (gRPC).debug exporter before wiring a backend.Try it: Basic
Which environment variable sets the service name every span will carry?
Now do it: Run one service with auto-instrumentation and a collector with the debug exporter, and read one span.
At the intermediate level traces are whole and pass through a collector.
OTEL_PROPAGATORS=tracecontext,baggage everywhere; check proxies, gateways, and message brokers carry the headers.k8sattributes and resourcedetection.receivers: [otlp], processors: [memory_limiter, k8sattributes, batch], exporters: [otlp].Try it: Intermediate
A message consumer's spans never join the producer's trace. What usually fixes it?
Now do it: Follow one request through a queue in your system and check whether the trace stays whole.
At the advanced level the pipeline keeps the right data and survives failures.
loadbalancing exporter routed by trace ID; policies for errors, latency, and a baseline percentage.file_storage extension, sized for the outage you accept.Try it: Advanced
During a 10-minute backend outage, the gateway lost 8 minutes of traces. What change addresses it?
Now do it: Compute your gateway's queue capacity in seconds at peak span rate.
At the master level OpenTelemetry is the platform's single path for telemetry.
Trade-off: a central gateway gives one place for policy and is one more tier to scale and keep available; agent-only setups are simpler and cannot tail-sample across nodes.
Try it: Master
Why do many platforms put a collector between services and the vendor, even when the vendor accepts OTLP directly?
Now do it: Sketch your telemetry path and mark where you could enforce redaction and sampling today.
A gateway collector configuration with the pieces this lesson talks about: memory protection, tail sampling, redaction, and a persistent queue. It is valid for recent Collector releases with the contrib components.
extensions:
file_storage:
directory: /var/lib/otelcol/queue
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
processors:
memory_limiter:
check_interval: 1s
limit_percentage: 80
spike_limit_percentage: 20
attributes/redact:
actions:
- key: http.request.header.authorization
action: delete
tail_sampling:
decision_wait: 30s
policies:
- name: errors
type: status_code
status_code: {status_codes: [ERROR]}
- name: slow
type: latency
latency: {threshold_ms: 2000}
- name: baseline
type: probabilistic
probabilistic: {sampling_percentage: 5}
batch: {}
exporters:
otlp/traces:
endpoint: tempo-distributor.observability:4317
sending_queue:
enabled: true
queue_size: 5000
storage: file_storage
retry_on_failure:
enabled: true
max_elapsed_time: 15m
service:
extensions: [file_storage]
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, attributes/redact, tail_sampling, batch]
exporters: [otlp/traces]
By default queue_size counts requests (batches), not spans, so capacity in spans is roughly queue_size times the batch size; check your release's sending_queue options. TLS between collectors and to the backend is left out to keep the example short; production configurations need it.
This is a composite of a failure pattern that keeps repeating; the details are illustrative. After a network change, checkout traces stopped showing the pricing service, and a pricing slowdown went unexplained for a day.
A synthetic request every minute is traced through every hop, and an alert fires when its trace has fewer services than expected.
Design the OpenTelemetry pipeline for 120 services on three Kubernetes clusters, sending traces, metrics, and logs to one backend per signal.
How many spans, data points, and log records per second at peak? Which languages need auto-instrumentation? What must be redacted? What outage of each backend must be survived without data loss? Who owns the collectors?
Say 60,000 spans a second at peak, with tail sampling keeping errors, traces over 2 seconds, and 5 percent of the rest; backends may be down for up to 15 minutes.
The Operator injecting auto-instrumentation; an agent DaemonSet per cluster with k8sattributes and memory_limiter; a gateway tier per cluster behind the load-balancing exporter by trace ID; tail sampling, redaction, and persistent queues sized for 15 minutes; collector self-metrics with alerts; a synthetic trace per cluster every minute.
A gateway tier adds a component to scale and a hop of latency, and makes tail sampling and central policy possible. Persistent queues need disk on the gateways. Longer decision_wait catches slow traces more completely and holds more data in memory.