Distributed Tracing
1. Executive Summary
Distributed tracing records the end-to-end path of a request as it traverses microservices, queues, databases, and external APIs—producing a trace composed of spans with timing, metadata, and causal parent-child relationships. While metrics show that latency increased and logs show what a single service logged, traces show where time was spent across the distributed call graph.
OpenTelemetry (OTel) is the vendor-neutral standard for instrumentation, context propagation, and export to backends (Jaeger, Tempo, Zipkin, Honeycomb, Datadog). Principal architects design tracing platforms for high-cardinality debuggability at controlled cost via head sampling, tail sampling, and attribute discipline—while ensuring critical paths (errors, high latency, payment flows) are always captured.
This chapter covers trace data model, propagation (W3C traceparent), instrumentation strategies, sampling architecture, correlation with logs and metrics, and operational use in Failure Analysis Methodology—not "install Jaeger and hope."
2. Why This Topic Matters
Without tracing, microservice incidents devolve into log archaeology:
- P99 latency spikes with no obvious culprit service.
- Cascading retries amplify load invisibly in per-service metrics.
- Async paths (Kafka, SNS) break request-scoped debugging.
- LLM and agent platforms need per-tool-call spans for cost and safety audit.
Principal interviews ask: explain span context propagation, head vs tail sampling tradeoffs, baggage risks, and how traces integrate with SLOs. Follow-ups on trace storage cost at 100K RPS separate platform architects from developers who only used auto-instrumentation once.
3. Problems Being Solved
| Problem | Tracing approach |
|---|---|
| Unknown slow service | Waterfall span timing |
| Hidden serial calls | Trace graph reveals N+1 |
| Missing cross-service correlation | Shared trace_id |
| Async causality | Span links across messages |
| Regression after deploy | Compare trace structure |
| Vendor lock-in | OpenTelemetry standard |
| Storage cost explosion | Sampling strategies |
| Agent/tool audit | Spans per tool invocation |
4. Assumptions and System Model
Data model (OpenTelemetry)
| Concept | Definition |
|---|---|
| Trace | End-to-end request story |
| Span | Single operation with start/end time |
| Trace ID | 128-bit identifier shared across services |
| Span ID | 64-bit identifier per span |
| Parent span | Upstream caller span |
| Attributes | Key-value metadata (http.method, db.statement redacted) |
| Events | Timestamped annotations on span |
| Baggage | Propagated key-value (use sparingly) |
| Span link | Associate spans without parent-child (async) |
Non-functional targets
- Propagation overhead < 1 ms per hop.
- Collector availability 99.9%.
- Trace query p99 < 3 s for recent data.
- Retention: 7 days full fidelity for sampled traces; error traces 30 days.
| Assumption | Implication |
|---|---|
| All services instrumented | Critical path 100% coverage goal |
| Context propagates over HTTP/gRPC | W3C traceparent standard |
| Async breaks parent chain | Span links required |
| PII in attributes forbidden | Redaction pipeline |
| 100% trace capture too expensive | Sampling mandatory at scale |
5. Essential Terminology
| Term | Definition |
|---|---|
| OpenTelemetry | CNCF observability framework |
| OTel SDK | Language instrumentation library |
| Collector | Receive, process, export telemetry |
| Exporter | Sends spans to backend |
| traceparent | W3C header carrying trace context |
| Head sampling | Decide at trace start |
| Tail sampling | Decide after trace completes |
| Probabilistic sampling | Random fraction (e.g., 1%) |
| Cardinality | Unique attribute combination count |
| Service map | Derived graph of dependencies |
| Exemplar | Link metric sample to trace ID |
| Instrumentation scope | Manual vs auto instrumentation boundary |
6. Core Mechanism
6.1 Tracing architecture
Figure 1: Distributed tracing pipeline—instrumentation, collector processing, storage, correlation with logs and metrics.
6.2 Context propagation
Figure 2: W3C traceparent propagates trace ID; each service creates child span.
6.3 Tail sampling decision
Figure 3: Tail sampling—keep errors and slow traces; probabilistic sample remainder.
6.4 Deep dives
Instrumentation layers:
| Layer | Coverage | Effort |
|---|---|---|
| Auto-instrumentation | HTTP, gRPC, DB drivers | Low |
| Manual spans | Business logic, cache keys | Medium |
| Platform sidecar | Mesh generates spans | Low per service |
Async messaging:
- Producer injects trace context in message headers.
- Consumer creates span linked to producer span (not child if batch consumer).
- Kafka headers:
traceparentpreserved across partitions.
Attribute discipline:
- Low cardinality:
http.route=/v1/orders/{id}template not raw URL. - Never: passwords, PAN, full prompt text in LLM spans—use hash attributes.
- High value:
tenant_id,payment_id,agent.run_id.
Cost model (illustrative—verify for your stack):
100K RPS × 5 spans/trace × 1KB = 500 MB/s raw
1% head sample → 5 MB/s ingest
Tail sampling keeps ~3% effective → adjust storage plan
7. Step-by-Step Walkthrough
7.1 Debugging P99 latency regression
- SLO dashboard shows checkout p99 up 400ms.
- Filter traces > 2s in last hour—tail sampling ensured capture.
- Waterfall shows payment service 350ms but DB span only 20ms—network?
- Discover new serial call to fraud service not in previous release.
- Action: parallelize fraud check; add span alert on new dependency depth.
7.2 Incident trace evidence
- SEV2: intermittent 500 errors on order API.
- Search traces with
http.status_code=500. - Common pattern: timeout calling inventory gRPC; upstream retry storm visible.
- Postmortem timeline corroborated with span timestamps UTC.
- Link Failure Analysis Methodology.
7.3 LLM gateway trace
- Agent run span parent; child spans per LLM call and tool invocation.
- Attributes:
llm.model,llm.input_tokens,llm.output_tokens,tool.name. - Finance chargeback from span metrics export.
7.4 Missing propagation gap
- Legacy monolith not instrumented—trace breaks at boundary.
- Appears as orphan spans or disconnected traces.
- Action: inject traceparent at monolith edge adapter; prioritize in roadmap.
7.5 Agent platform trace audit
- Compliance requests all
issue_refundtool spans for Q2. - Filter trace backend by
tool.nameand date range; join HITL approval IDs. - Verify 100% high-risk tools have parent
agent.runspan—gaps indicate instrumentation bypass. - Action: block tool execution if
traceparentmissing—policy in tool gateway. - Principal: Agentic AI Platform Design and tracing are jointly designed for auditability.
7A. Sampling Decision Record Template
| Field | Example |
|---|---|
| Date | 2026-07-25 |
| RPS | 100,000 |
| Head rate | 0.5% |
| Tail rules | errors, >2s, payment |
| Effective rate | ~3% |
| Monthly storage | 38 TB |
| Review date | 2026-10-25 |
8. Invariants and Guarantees
| Property | Type | Mechanism |
|---|---|---|
| Trace ID continuity | Safety | Propagation standard enforced |
| Clock skew tolerance | Liveness | Relative span durations valid |
| PII not in spans | Safety | Scrub processor + lint rules |
| Error trace retention | Safety | Tail sampling keep rules |
| Sampling decision consistency | Safety | Head sample flag propagated |
9. Failure Scenarios
| Scenario | Mitigation |
|---|---|
| Collector overload | Horizontal scale; backpressure |
| Broken propagation | Orphan spans; CI test for headers |
| Baggage bloat | Disable or allowlist keys |
| Storage full | Retention reduction; aggressive sample |
| High-cardinality attribute | Drop attribute; alert on cardinality |
| Trace UI slow | Index by trace_id; time partition |
| Auto-instrumentation gap | Manual span for critical path |
| Sampling misses rare bug | Always-sample flag for canary users |
10. Performance Characteristics
Propagation: ~microseconds per inject/extract
Span export batch: async non-blocking
Collector batch processor: 1-5s delay typical
Backend query by trace_id: O(1) with index
Service map rebuild: periodic aggregate job
Overhead target: <3% CPU with SDK at 1% sample
| Scale | Approach |
|---|---|
| 1K RPS | 10-100% sample feasible |
| 50K RPS | 0.1-1% head + tail keep errors |
| 500K RPS | Dedicated collector tier; aggressive tail rules |
11. Scalability Limits
| Limit | Mitigation |
|---|---|
| Trace storage cost | Sampling; shorter retention |
| Cardinality explosion | Template routes; avoid user IDs as metric labels in derived metrics |
| Collector single point | Regional collectors |
| Large trace (1000+ spans) | Span limits; deep agent loop concern |
| Cross-region latency | Export to regional backend |
| Query fanout | Trace ID direct lookup only |
12. Operational Considerations
- SLO on collector pipeline lag < 30s.
- Dashboards: spans/sec, sample rate, orphan span rate, collector errors.
- Runbooks: backend down—SDK buffer drop policy documented.
- Lint CI: block merge if custom spans include banned attributes.
- On-call: tracing not blocking incident mitigation—have metrics fallback.
13. Security Considerations
- Traces may leak business logic timing—access RBAC on trace UI.
- Scrub SQL statements; parameterize attributes.
- LLM prompts: log hash only unless debug session with approval.
- Tenant isolation in multi-tenant backend—filter by
tenant_idclaim. - Align retention with compliance—GDPR erasure requests on trace data.
14. Cost Considerations
Trace storage is largest observability bill at scale after logging. Tail sampling ROI: keep 100% of errors with <5% storage. Managed vendors charge per span ingested—model before 100% mandate. Open-source Tempo on object storage cheaper than indexed Jaeger at high volume—query tradeoffs.
15. Production Implementations
| Backend | Pattern |
|---|---|
| Grafana Tempo | Object storage; trace ID query |
| Jaeger | CNCF; Kubernetes common |
| Honeycomb | High-cardinality analysis SaaS |
| AWS X-Ray | AWS-native integration |
| Datadog APM | Commercial full stack |
16. Alternatives and Tradeoffs
| Decision | Tradeoff |
|---|---|
| Head vs tail sampling | Simplicity vs capture errors |
| Auto vs manual instrumentation | Coverage vs business context |
| Sidecar vs in-process SDK | Uniformity vs resource cost |
| Central vs per-service collector | Ops simplicity vs blast radius |
| Long vs short retention | Debuggability vs cost |
| Baggage propagation | Context vs header bloat risk |
17. Common Misconceptions
| Misconception | Reality |
|---|---|
| "100% tracing always" | Cost prohibitive at scale |
| "Metrics replace traces" | Different questions answered |
| "Auto-instrumentation enough" | Business spans needed for debug |
| "Logs sufficient with trace_id" | Logs without propagation still siloed |
| "Tracing is free with SaaS" | Per-span billing adds up |
| "Same trace_id = parent-child" | Async needs span links |
18. Principal Architect Perspective
- Tracing is incident multipliers—invest in propagation standards day one.
- Sampling is architecture decision, not ops afterthought.
- Attribute schema governance prevents cardinality and PII incidents.
- Correlate three pillars: exemplars link metrics → traces → logs.
- Agent/LLM platforms require trace-first design for audit.
- Mandate OpenTelemetry—avoid vendor SDK lock-in per service.
19. Architecture Review Exercise
Scenario: Each team runs separate Jaeger with incompatible instrumentation; traces break at every handoff.
Review: Mandate W3C traceparent; central OTel collector; shared attribute conventions document; CI propagation test.
20. Whiteboard Explanation
"Every service uses OpenTelemetry SDK with W3C traceparent propagation on HTTP and gRPC. Gateway starts root span; downstream creates child spans. Async Kafka messages inject context with span links on consume. Spans export to regional collectors with tail sampling—keep all errors and SLO violations plus one percent random. Backend Tempo on S3; query by trace_id from logs. Attributes use low-cardinality route templates—no PII. Metrics histograms include exemplars pointing to trace IDs for slow requests. Agent platform adds spans per tool call for audit and cost."
21. Interview Questions
- Design tracing for 50K RPS. — Signals: sampling, collector scale, cost. Red flags: 100% capture.
- Head vs tail sampling? — Signals: error capture, latency. Follow-up: implementation.
- Explain traceparent header. — Signals: trace ID, span ID, flags.
- Async Kafka tracing? — Signals: inject context, span links.
- Orphan spans cause? — Signals: broken propagation. Red flags: "random glitch."
- Cardinality in attributes? — Signals: template routes, PII avoid.
- Trace vs log vs metric? — Signals: questions each answers.
- Debug P99 with traces? — Signals: tail keep slow, waterfall analysis.
- OpenTelemetry benefit? — Signals: vendor neutral, standard propagation.
- LLM span attributes? — Signals: tokens, model, no raw prompt.
- Baggage risks? — Signals: header size, PII leakage.
- Exemplar link to metrics? — Signals: metric → trace drilldown.
22. Interview Follow-Ups
- Collector down during incident. — SDK buffer policy; metrics still work; fix collector P1.
- Trace shows wrong parent timing. — Clock skew; use relative durations.
- Regulatory request to delete user data in traces. — Retention + erase by user_id attribute.
22A. Production Low-Level Design (Interview + Game Day)
OpenTelemetry pipeline with W3C Trace Context and head + tail sampling for tail-latency capture. Production LLD and Game Day Standard.
Control vs data plane
| Plane | Components |
|---|---|
| Control | Sampling policies, attribute schema, propagation standards, retention |
| Data | SDK spans → regional collector → tail sampler → object-storage backend |
Step-by-step propagation (W3C):
| Step | Header / field | Rule |
|---|---|---|
| 1 | traceparent: 00-{trace-id}-{parent-span-id}-01 | Gateway starts or continues trace |
| 2 | Child span new span-id; same trace-id | Parent-child in sync HTTP/gRPC |
| 3 | Producer injects traceparent into message headers | Async must not break context |
| 4 | Consumer creates span link (not parent) | Preserves causality without fake parent timing |
| 5 | Tail sampler keeps trace if any span error or duration > SLO | Captures rare tail latency |
Sampling contract
| Stage | Policy | Rationale |
|---|---|---|
| Head | 0.5% consistent (sampled flag propagated) | Bound ingest at 100K+ RPS |
| Tail | Keep 100% errors; p99 > 2s; business.critical=payment; then 1% random | Don't lose incidents or tails |
| Attributes | Templated http.route; no PII | Cardinality + compliance |
One SLO
Trace pipeline lag: collector export p99 < 30s; orphan span rate < 0.1%; alert when effective sample rate drops without policy change.
22B. Game Day Playbooks
| # | Drill | Inject | Detect | Mitigate | Verify |
|---|---|---|---|---|---|
| GD-1 | Broken W3C propagation | Strip traceparent at one hop | Orphan span rate ↑ | Fix middleware; CI test | Single trace across 5 services |
| GD-2 | Tail latency invisible | Head-only 0.1% sample; inject 3s spikes | SLO burn; no traces | Enable tail keep slow >2s | Waterfall shows slow span |
| GD-3 | Collector outage | Stop collector 15 min | SDK buffer drop metric | Metrics/logs fallback; restore collector | No data loss on errors post-restore |
GD-2 — Tail sampling catches p99 regression
23. Strong Answer Example
Q: How sample traces at scale without losing incidents?
Answer this as a 45-minute design discussion using the PRACTICE framework. Below is how a strong student sounds aloud—W3C propagation + head/tail sampling + cost math, not "trace everything."
Student interview script (PRACTICE)
P — Problem framing
"At 100K RPS with ~8 spans per request, 100% tracing is hundreds of GB/s—unaffordable. But if we sample too aggressively, SEV2 incidents have no waterfall and p99 tail latency disappears from the backend.
Short answer: W3C traceparent everywhere (CI-tested), head sample ~0.5% with consistent downstream flag, collector tail sampling to keep errors, SLO violations, and critical flows, then 1% of the rest. Exemplars link metrics to
trace_idfor the slow requests we do keep."
R — Requirements
| Requirement | Design |
|---|---|
| 100K RPS sustainable ingest | Head sample + tail policies |
| Never lose error traces | Tail keep status=ERROR |
| Capture tail latency | Tail keep duration > SLO threshold |
| Cross-service continuity | W3C Trace Context mandatory |
| Cost visibility | Dashboard: spans/day, effective rate |
A — Assumptions
| Assumption | Implication |
|---|---|
| ~8 spans/trace, ~800 bytes/span | BOE ingest model required |
| OpenTelemetry SDK + collector | Central policy enforcement |
| Payment/checkout is critical | Attribute-based tail keep |
| Async Kafka between services | Span links, not fake parent-child |
| Tempo-on-S3 or X-Ray backend | Query by trace_id from logs |
C — Capacity (back-of-envelope)
Raw: 100K RPS × 8 spans × 800 B ≈ 640 MB/s (impossible at 100%)
Head 0.5%: ~3.2 MB/s into collector buffer
Tail keep: errors 100% + slow + payment ≈ 3–5% effective of started traces
Storage 7d: model TB/month — adjust policies quarterly
Orphan rate: alert > 0.1% — propagation broken
T — Topology
| W3C field | Purpose |
|---|---|
trace-id | 128-bit correlation across services |
parent-span-id | Child span parenting |
trace-flags sampled | Downstream respects decision |
tracestate | Vendor extensions (optional) |
Tail policy order: errors → latency > 2s → business.critical → probabilistic 1%.
I — Invariants
"Non-negotiable:
- traceparent on every sync and async boundary—CI regression test.
- Consistent head sampling—downstream honors
sampledflag.- Tail before drop—buffer completes trace before decision.
- Low-cardinality attributes—
http.route=/orders/{id}not raw URL.- No PII in spans—hash user id if needed."
C — Constraints
| Constraint | Response |
|---|---|
| Rare bug at 0.001% traffic | Tail on error + exemplar from metric |
| Collector memory | Regional collectors; limit buffer size |
| Cross-region | Export to regional backend |
| Agent/LLM 1000+ spans | Span limits; summarize tool calls |
| Regulatory erase | Retention TTL + delete by hashed user_id |
E — Evolution
| Phase | Deliverable |
|---|---|
| M1 | W3C propagation + CI test on every service PR |
| M2 | Head 0.5% + tail error/slow policies |
| M3 | Exemplars on checkout latency histogram |
| M4 | Cost dashboard; quarterly sampling review |
| M5 | Game day: strip header → orphan alert fires |
Closing line (interview)
"I'd mandate W3C traceparent, head sample 0.5% with propagated flag, and collector tail sampling that always keeps errors, spans over SLO, and payment, plus 1% random. Exemplars bridge metrics p99 to traces. I'd measure effective sample rate and orphan spans—if orphans spike, propagation is broken, not sampling."
Scoring signals
| Strong | Weak / red flag |
|---|---|
| Head + tail + cost BOE | "Enable 100% tracing" |
| W3C + async span links | Orphan traces accepted |
| Tail keeps SLO violations | Head-only misses rare slow |
| Exemplar metric → trace | Grep logs only |
| CI propagation test | "Middleware will handle it" |
Compact outline (2 minutes)
"100K RPS can't store 100%. OTel everywhere, W3C traceparent, head 0.5%, tail keep errors + >SLO + critical + 1%. Exemplars on latency histogram. Alert orphan spans. Quarterly cost review."
24. Weak Answer Example
Weak: "We log trace IDs sometimes and use grep across logs."
Red flags: No propagation standard, no spans, no sampling strategy, no waterfall debug.
25. Hands-On Exercise
- Instrument two local services with OTel; verify single trace in Jaeger/Tempo.
- Break propagation intentionally; observe orphan spans.
- Configure collector tail sampling keep on error.
- Add manual span around business operation with attributes.
- Extension: Kafka producer/consumer span link.
- Extension: Grafana exemplar from metric to trace.
26. Knowledge Check
- Trace vs span?
- traceparent components?
- Head sampling timing?
- Tail sampling benefit?
- Span link vs parent-child?
- Why low-cardinality attributes?
- OpenTelemetry collector role?
- Exemplar purpose?
- Orphan span meaning?
- PII in spans policy?
- Agent tool audit via traces?
- Storage cost driver?
26A. Extended Knowledge Check
- What is tracestate header used for?
- When use span events vs child spans?
- How do exemplars connect metrics to traces?
- What causes orphan spans in production?
- Agent run trace—minimum span set for audit?
- Sampling decision record—why document effective rate?
27. Flashcards
| Front | Back |
|---|---|
| Span | Single timed operation |
| Trace ID | 128-bit request identifier |
| traceparent | W3C propagation header |
| OpenTelemetry | CNCF telemetry standard |
| Head sampling | Decide at trace start |
| Tail sampling | Decide after complete trace |
| Span link | Async causal association |
| Collector | Telemetry processing pipeline |
| Exemplar | Metric sample linked to trace |
| Cardinality | Unique label combinations |
| Baggage | Propagated context key-values |
| Waterfall | Span duration visualization |
28. Cheat Sheet
MODEL: trace = spans tree + optional links
PROPAGATE: W3C traceparent HTTP/gRPC/messaging headers
INSTRUMENT: OTel auto + manual business spans
PIPELINE: SDK → collector → process/scrub/sample → backend
SAMPLE: head low % + tail keep errors/SLO violations/key flows
ATTRIBUTES: low cardinality; no PII; template routes
ASYNC: inject headers; span links on consume
CORRELATE: logs include trace_id; metrics exemplars
COST: sampling + retention + cardinality discipline
DEBUG: waterfall find slow span; compare deploy traces
28A. Principal Interview Deep Dive
Semantic conventions discipline
OpenTelemetry semantic conventions evolve—principal architects publish org attribute schema:
| Attribute | Required | Cardinality |
|---|---|---|
service.name | Yes | Low |
http.route | Yes (templated) | Low |
tenant.id | If multi-tenant | Medium—don't metric label |
enduser.id | Avoid in spans | High—use hash |
db.system | Yes for DB spans | Low |
llm.model | For AI paths | Low |
CI linter rejects non-schema attributes on merge.
Tail sampling collector config (conceptual)
processors:
tail_sampling:
policies:
- name: errors
type: status_code
status_code: ERROR
- name: slow
type: latency
threshold_ms: 2000
- name: payment
type: string_attribute
key: business.critical
values: [payment]
- name: probabilistic
type: probabilistic
sampling_percentage: 1
Order matters—evaluate error and slow before probabilistic drop.
Debugging playbook: P99 latency
- Metrics: histogram p99 by
service+ exemplar trace_id. - Trace: waterfall—identify longest span.
- If DB span long: check query, lock waits, missing index.
- If HTTP client span long: downstream dependency—open child trace.
- If gap between spans: thread pool queueing or CPU throttle.
- Compare trace structure pre/post deploy—new serial call?
Document finding in incident channel with trace link—not screenshot only.
Propagation test in CI
def test_traceparent_propagated():
resp = client.get("/api/orders", headers={"traceparent": "00-abc-def-01"})
assert resp.headers["traceparent"].startswith("00-abc-")
# verify downstream mock received same trace id
Prevents regression when new middleware strips headers.
Cost projection worksheet
RPS: 100,000
Spans per trace: 8
Bytes per span: 800
Sample rate: 1% head × tail keep 3% effective ≈ 0.03
Ingest: 100K × 8 × 800 × 0.0003 ≈ 192 MB/s
Storage 7d: ~116 TB raw—compress ~3× → ~39 TB
$ per TB-month: vendor-specific—model before mandate
Numbers illustrative—force FinOps conversation before 100% sampling requests.
29. Related Concepts
- Observability Fundamentals
- Partial Failure
- Failure Analysis Methodology
- SLO, SLI, and Error Budgets
- Service Mesh and Sidecars
- LLM Gateway
- Agentic AI Platform Design
- API Platform
19A. Extended Review Scenario
Scenario B: Each team runs different tracing vendor; traces break at every service boundary.
Review: Mandate W3C traceparent propagation and OpenTelemetry SDK—backend can remain heterogeneous short term but context must be universal. Central collector fan-in to single query UI for incidents. CI propagation test on every service PR. Sunset duplicate vendor agents to reduce pod overhead. Principal architects treat propagation as protocol standard, not optional SDK feature.
23A. Additional Strong Answer
Q: Debug N+1 query pattern with traces.
Outline: Filter checkout traces >1s. Waterfall shows 50 sequential db.query spans each ~10ms under single HTTP handler span—classic N+1. Compare to golden trace with one db.query batch span. Root cause: ORM lazy load in loop. Fix: eager load or DataLoader batching. Add lint rule detecting >10 child DB spans per request in CI on sample traffic. Document in service README. Trace made invisible ORM problem visible—metrics showed only "DB slow aggregate."
28B. Extended BOE Walkthrough (Interview Script)
Interviewer: "Design tracing for 100K RPS microservices."
Strong candidate:
"100K RPS × 8 spans × 800 bytes = 640 GB/s raw—impossible to store 100%.
OpenTelemetry everywhere; W3C traceparent mandatory—CI propagation test.
Head sample 0.5% with consistent downstream flag.
Collector tail sampling: keep all errors, duration >SLO, business.critical=payment, then 1% random.
Backend: Tempo on object storage—query by trace_id from logs via exemplars.
Attributes: templated http.route not raw URL; no PII; tenant_id ok in spans not metric labels.
Async Kafka: span links on consume—not parent child.
Cost dashboard: spans ingested per day; adjust sampling quarterly.
Incident: filter slow checkout traces—waterfall finds new serial fraud call post-deploy.
Orphan spans metric alerts broken propagation—fix before next incident."
30. References
- OpenTelemetry specification — traces, propagation, semantic conventions (standard).
- W3C Trace Context — traceparent/tracestate (standard).
- Dapper paper (Google) — foundational distributed tracing research.
- Grafana Tempo documentation — object-storage trace backend (implementation).
- OpenTelemetry Collector configuration — processors and exporters.
Distinction: Dapper model is conceptual foundation; OTel semantic conventions evolve; backend query capabilities vary significantly between Jaeger, Tempo, and SaaS vendors.
30A. Further reading paths
Instrument a sample app per OpenTelemetry quickstart; break and fix propagation. Study Observability Fundamentals three-pillar correlation and Failure Analysis Methodology for incident trace usage. Review semantic conventions for HTTP, gRPC, and database spans before defining org attribute schema.
Exercise: Configure tail sampling to keep 100% of errors and 1% of success; measure storage delta over 24 hours. Interview drill: whiteboard head vs tail sampling architecture with collector buffers, policy rules, and cost tradeoff—interviewer may push on "what if rare bug only hits 0.001% of traces?"