Distributed Trace Pipeline: From Tail Sampling to Tempo Service Graphs
Receiving application OTLP
Section titled “Receiving application OTLP”The otel-apps Deployment receives all OTLP trace/metric/log data sent by applications, but the three signal pipelines diverge right after the receiver stage. Only the trace pipeline goes through a separate processor chain.
Processor order
Section titled “Processor order”processors: tail_sampling: decision_wait: 10s policies: - name: latency-policy type: latency latency: { threshold_ms: 500 } - name: error-policy type: status_code status_code: { status_codes: [ERROR] } - name: probabilistic-policy type: probabilistic probabilistic: { sampling_percentage: 5 } memory_limiter: check_interval: 5s limit_percentage: 80 resource: attributes: - key: service.instance.id action: insert from_attribute: k8s.pod.uid batch: send_batch_size: 512 timeout: 5sThe order is tail_sampling → memory_limiter → resource/transform → batch. Tail sampling comes first so that every processor after the sampling decision only handles spans that will actually be exported, cutting unnecessary work.
The actual tail sampling policy
Section titled “The actual tail sampling policy”| Policy | Condition | Purpose | Retained |
|---|---|---|---|
| latency-policy | latency ≥ 500ms | Prioritize capturing slow requests | 100% retained |
| error-policy | status = Error | Root cause analysis | 100% retained |
| probabilistic-policy | Remaining normal requests | Baseline performance visibility | 5% sampled |
Policies are evaluated with OR logic: if any one of the three conditions is met, that trace is forwarded to Tempo.
Correcting an earlier mistake
Section titled “Correcting an earlier mistake”The earlier integrated-observability post stated “10% of normal traffic collected.” The actual probabilistic_policy.sampling_percentage value in the deployed otel-apps manifest is 5. From this post forward, 5% is the value used.
Tempo Distributed write/query path
Section titled “Tempo Distributed write/query path”- Traces are written distributor → ingester → Azure Blob, and the compactor prunes old blocks against a 168h retention window.
- Query-frontend/querier handles reads; the gateway is enabled but multitenancy is disabled.
From trace to metric: spanmetrics and service graphs
Section titled “From trace to metric: spanmetrics and service graphs”Only sampled traces are stored in Tempo, but metric derivation happens against every span received, before sampling. otel-apps’s spanmetrics connector extracts request count/latency/error rate from every incoming span and remote-writes it to Mimir, while Tempo’s Metrics Generator separately turns inter-service call relationships into metrics using service_graphs, span_metrics, and the local blocks processor.
# Tempo Metrics Generator configuration (generalized)metrics_generator: processors: - service-graphs - span-metrics - local-blocks registry: external_labels: source: tempo storage: remote_write: - url: http://mimir-gateway.mimir.svc.cluster.local/api/v1/pushThanks to this structure, even though only the sampled 5% of traces persist, the overall request rate, error rate, and service map stay accurate because they’re derived from 100% of spans.
Correlation
Section titled “Correlation”Grafana’s Tempo datasource has correlation settings that let you jump from a trace ID to logs/metrics/profiles. This is covered in detail alongside the datasource configuration in part 5, the Dashboard post. Here it’s enough to note that traces are the underlying data behind the service map/node graph.
Failure/scale trade-offs
Section titled “Failure/scale trade-offs”- Tail sampling is stateful: every span belonging to one trace has to arrive at the same Collector instance for a sampling decision to be made. Simply horizontal-scaling
otel-appswithout hashing onservice.nameortraceIDcould scatter spans of the same trace across different instances and break the sampling decision. - A single-replica development environment constraint: this issue hasn’t surfaced yet because
otel-appscurrently runs at a single replica. Scaling out would first require trace affinity, e.g., a load-balancing exporter that routes the same trace to the same instance.
Next post
Section titled “Next post”Dashboards and correlation continue in Operating Grafana Dashboards: Signal Correlation and GitOps Boundaries.