Telemetry privacy and correlation
Collect logs and traces with intentional boundaries
A node-level logging agent can forward container logs to a central backend; a separate telemetry collector can receive, process and export instrumented signals. OpenTelemetry provides instrumentation and collection interfaces, not a mandatory storage backend. Loki is a log aggregation system; Grafana can query it and other data sources. Elastic provides integrated search and observability for logs, metrics and traces. Choose based on ingestion, query, retention, access and operational requirements, not an assumed universal feature parity. No service is installed in this exercise.
application stdout -> log agent -> log storeapplication instrumentation -> OTel collector -> trace backendmetric scraper -> time series storequery UI -> authorized data sourcesCorrelate by trace and span identifiers
Propagate trace context across service calls; record the active trace ID and span ID with structured log entries where available. A request ID can serve a local operational purpose but is not necessarily a trace ID. Match trace IDs exactly, then use span ID, service and time to narrow the investigation. In the offline fixture both catalog and inventory logs belong to the same trace; an unrelated trace is excluded. A missing trace might reflect sampling or lost context rather than proof of no request.
{ "service": "inventory", "trace_id": "11111111111111111111111111111111", "span_id": "2222222222222222", "event": "lookup_timeout", "duration_ms": 780}Redact before export and limit access
Telemetry may contain tokens, emails, request bodies and other sensitive details. Prefer not collecting them. Use a reviewed allowlist of structured fields at the source, validate allowed values, and add filtering at the collection boundary as defense in depth. Avoid raw exception messages or arbitrary baggage values until their contents are reviewed. Protect transport, backend access, retention and deletion. The fixture sanitizer keeps a fixed set of fields and drops all other keys; in real applications allowed fields can still contain sensitive values and require validation. Never use real credentials in a test.
Allowed fields: service, trace_id, span_id, event, duration_msDropped: authorization, email, body, raw_urlNote: field names alone cannot prove values are safe.Choose sampling and retention deliberately
Head sampling makes a decision early in the trace lifecycle, without knowing its final outcome. Tail sampling can make a later decision using more of the completed trace, but requires buffering, routing and bounded memory. Prefer a documented policy that balances coverage, privacy and cost; sampling is not a privacy control. A missing sampled trace does not prove a request never occurred. Logs, metrics and traces can have different retention needs. Events are not durable audit evidence and should not be repurposed as an audit log.
Illustrative policy: retain error traces plus a bounded baseline sample; review buffering limits, dropped spans, storage and access. No collector configuration is implied.Practice privacy-aware diagnosis
Run the local validator from lab-fixtures/observability to check fixture arithmetic, signal selection and correlation. Review redaction-cases.json before exporting any diagnostic sample. Use the fixed synthetic trace to identify the slow span and write a short finding that distinguishes measured observations from hypotheses. In a real incident check clock alignment, sampling and missing spans before inferring ordering. No log shipping, external queries or cluster access are needed.
Further reading and practice
Offline lab: lab-fixtures/observability/README.md. These examples are synthetic; no cluster execution was tested. Selected official sources are listed in the chapter review.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Telemetry privacy and correlation — knowledge check
Interpret synthetic observability evidence.
What links log records to a particular distributed trace?
What is the safest starting approach to sensitive fields?
When is a head sampling decision normally made?
Does OpenTelemetry itself require a specific storage backend?
A trace is missing after sampling. What should you conclude?