---
title: Observability
summary: Shared structured logging, OpenTelemetry signals, and health checks support diagnosis across BookWorm services.
owners:
  - platform-engineering-team
badges:
  - content: Cross-cutting Concept
    backgroundColor: purple
    textColor: purple
---

## Purpose and Scope

Observability provides a consistent evidence model for diagnosing frontends, APIs, workers, data pipelines, and external dependencies. It governs signal names, correlation, privacy, health semantics, and retention across all deployed building blocks.

## Visual Reference

**Observability Pipeline**

<MermaidFileLoader file="mermaids/004-observability-diagram-1.mmd" />

## Core Rules and Standards

1. **Propagate one correlation chain.** Carry trace, request, and operation identifiers across HTTP, RPC, events, and scheduled work.
2. **Emit structured data.** Use stable field names and structured attributes; avoid embedding sensitive or variable narrative into identifiers.
3. **Capture the three signals.** Distributed traces explain causality, logs explain local events, and metrics quantify behavior and failure rates.
4. **Protect telemetry data.** Apply PII and secret redaction before export; do not place payloads or credentials into trace attributes.
5. **Instrument dependencies consistently.** Cover inbound, outbound, database, broker, cache, external AI, and health interactions according to the capability boundary.
6. **Separate liveness and readiness.** Liveness identifies an unusable process; readiness identifies whether the process can serve required work.
7. **Use health as a contract.** Every probe must test a meaningful dependency or process state and avoid cascading load into external systems.

<Admonition type="warning">
	Telemetry proves that an operation or step occurred. It does not prove that an asynchronous
	business outcome completed; final state must be reconciled through the owning capability.
</Admonition>

## Mechanism / How It Works

| Signal | Minimum Convention                                                                                                    |
| :----- | :-------------------------------------------------------------------------------------------------------------------- |
| Trace  | One request or operation ID chain across synchronous and asynchronous hops; include outcome and dependency attributes |
| Log    | Timestamp, severity, component, trace and correlation IDs, event reason, and redacted operation context               |
| Metric | Stable service and operation names; success, failure, latency, saturation, and retry or queue indicators              |
| Health | Explicit liveness and readiness checks, environment-aware probe endpoints, and dependency timeout bounds              |

## Correlation and Privacy

- Generate or preserve a correlation identifier at the external ingress boundary.
- Forward that identifier in downstream calls and integration envelopes.
- Include the same identifier in user-visible error details only when safe to do so.
- Record entity identifiers and operation names when useful, but do not log raw prompts, secrets, payment details, or full customer payloads.
- Route sensitive or high-volume diagnostic context through the same redaction and retention controls as other telemetry.

## Verification and Governance

- Test that end-to-end traces survive frontend, gateway, API, worker, and broker hops.
- Verify metric cardinality and ensure untrusted values cannot create unbounded label sets.
- Alert on symptom indicators such as error rate and latency, then diagnose with correlated traces and logs.
- Review probe behavior and telemetry retention for each environment before release.

## Related Documentation

- [[doc|operational/002-observability-and-diagnostics]] — Operational dashboards and diagnostic procedures.
- [[doc|arc42/08-crosscutting-concepts/001-security-and-privacy]] — Redaction and PII boundaries.
- [[doc|arc42/08-crosscutting-concepts/003-validation-errors-and-resilience]] — Error and retry behavior.
