OpenTelemetry for NestJS: Distributed Tracing in Production (2026)


A production-grade reference for building AI agents on AWS Bedrock with a NestJS gateway in 2026 — Bedrock AgentCore, action groups backed by Lambda, knowledge bases over S3 + OpenSearch, the routing-and-guardrail layer that NestJS must own, the model-selection cost arithmetic, three-layer observability (gateway + agent-internal + per-token cost), Bedrock Guardrails plus app-specific PII redaction, multi-agent collaboration patterns, and the failure modes you only learn about by running this in production.
Most teams that say they "do DDD" have a folder called domain/ and occasional meetings with a product manager. The genuine practice — bounded contexts that match the business, aggregates that protect invariants, ubiquitous language that survives the trip from whiteboard to code — is rare because it is harder than its surface description. NestJS is one of the few back-end frameworks whose primitives are well-suited to a serious DDD implementation. This guide covers bounded context mapping, aggregate sizing, the ideal layered folder structure, the repository pattern done correctly versus the DAO that pretends to be one, domain events through the in-process bus, and composition with the Saga, Outbox, and Event-Driven Architecture patterns.
The first instinct when wiring observability into an LLM system is to treat the LLM call as just another HTTP outbound call. Within a week the team realises conventional observability is missing everything that matters — the span tells you the call took 4.2 seconds and returned 200 OK but does not tell you token counts, cost in dollars, model variant, prompt template version, eval scores, tool calls, or whether the response was a hallucination versus a useful answer. Conventional observability tells you the system is up; AI observability needs to tell you whether the system is producing useful output at acceptable cost. This article covers the OpenTelemetry GenAI semantic conventions stabilising in late 2025/early 2026, what to instrument and how, the agent trace hierarchy that makes multi-step debugging tractable, how to attribute token cost across a multi-tenant deployment, how to surface eval scores as first-class telemetry, and the dashboards every production AI team should have on day one.
Event sourcing for production microservices in 2026 — aggregate boundaries, append-only stores, snapshot strategy, projection rebuilds, and schema evolution.
Advertise and partner
Reach engineering leaders and CTOs reading about AI, mobile and cloud architecture.
Sponsored mentions and co-authored articles or technical deep-dives. Relevant products only, always disclosed.