ADR-BW-013: Use shared structured logging and OpenTelemetry
Produce correlated logs, traces, metrics, and configured health signals while keeping business completion separate from process health.
| Field | Value |
|---|---|
| Status | Proposed |
| Date | 2026-11-07 |
| Owners | Platform Engineering TeamTeamPlatform Engineering TeamPlatform team providing BookWorm's thinnest viable platform—orchestration, messaging fabric, scheduling, notifications, ...Open docs |
| Affected Resources | BookWormDomainv1.0.0BookWormCore e-commerce domain for the BookWorm online bookstore, coordinating catalog discovery, customer baskets, order fulfil...Ownerarchitecture-enabling-teamDiagramRepositoryOpen docs |
| Related ADRs | ADR-BW-003: Reuse Aspire and shared technical service defaultsDecision Recordv1.0.0ADR-BW-003: Reuse Aspire and shared technical service defaultsShare orchestration and technical host configuration without moving business rules into the platform foundation.Ownerplatform-engineering-teamOpen docs, ADR-BW-010: Preserve message identity and cross-boundary correlationDecision Recordv1.0.0ADR-BW-010: Preserve message identity and cross-boundary correlationCarry stable integration identity and request context for routing and diagnosis without using correlation fields as auth...Ownerplatform-engineering-teamOpen docs, ADR-BW-015: Separate logical architecture from environment configurationDecision Recordv1.0.0ADR-BW-015: Separate logical architecture from environment configurationDocument configured dependencies and environment differences explicitly instead of inferring production infrastructure f...Ownerplatform-engineering-teamOpen docs |
Context & Problem Statement
BookWorm journeys cross microfrontends, gateways, APIs, background workers, and AI providers. Isolated text logs cannot diagnose cross-service latency or failures, while unredacted full-capture telemetry in production risks exposing customer PII and inflating observability costs.
Decision Drivers
- Cross-service visibility: Correlate logs, traces, and metrics across sync and async boundaries.
- Vendor neutrality: Standardize on OpenTelemetry rather than proprietary SDKs.
- Privacy and cost control: Redact PII and apply environment-appropriate sampling.
Options Considered
| Option | Pros | Cons |
|---|---|---|
| OpenTelemetry + structured logging with PII redaction & sampling | Unified local (Aspire) and Azure telemetry; vendor-neutral; cost-controlled | Deployments must verify exporter and redaction configuration |
| Unstructured per-service text logs | Minimal setup | Impossible to trace distributed latency or async failures |
| 100% unsampled production tracing | Captures every request | Prohibitive ingestion/storage cost at scale |
| Proprietary vendor APM SDKs | Rich vendor-specific UI | Locks services to one vendor and diverges from local Aspire tooling |
Decision & Consequences
Chosen Option: Standardize on OpenTelemetry traces, metrics, and structured logs across all services and frontends, exporting to the Aspire Dashboard locally and Azure Monitor / Log Analytics in cloud environments with PII redaction and environment-tuned sampling. Health probes report process/dependency readiness only, never business-workflow completion.
- Positive: Operators trace requests seamlessly from Storefront through Kafka and Durable Functions.
- Negative: Production sampling can omit low-frequency traces unless error-based or tail sampling is configured.
Compliance Criteria
- All services must export OpenTelemetry traces, metrics, and structured logs via shared defaults.
- Telemetry must never record raw customer prompts, emails, addresses, or auth tokens.
- Health endpoints (
/health,/alive) must report liveness/readiness only, not business state.