tracing

Implement Sentry tracing, distributed logging, and AsyncLocalStorage context across NestJS services.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mthang1801/go-domain-driven-design --skill tracing-mthang1801
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tracing
Source: https://github.com/mthang1801/go-domain-driven-design/tree/main/.claude/skills/tracing
Command: npx skills add https://github.com/mthang1801/go-domain-driven-design --skill tracing-mthang1801

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Sentry tracing, distributed logging, and AsyncLocalStorage-based request context for NestJS streamline end-to-end observability, enabling reliable correlation across services and improved debugging.

Core Features & Use Cases

  • Decorator-driven tracing: use @LogExecution to automatically create and chain spans for method executions.
  • HTTP + inter-service tracing: global interceptor to establish Sentry transactions and controller spans for incoming requests, with seamless cross-service propagation.
  • ALS-based context + Winston: per-request session context, enriched logs, and Sentry breadcrumbs for unified insights.
  • Cross-service propagation: extract/propagate trace headers when calling other services (RabbitMQ/Kafka, HTTP).
  • Developer-friendly patterns: manual span creation utilities and safe trace management.

Quick Start

Start the NestJS app with tracing enabled to begin collecting Sentry traces, logs, and ALS context immediately.

Frequently Asked Questions about tracing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement distributed tracing in a NestJS microservices architecture?

To establish distributed tracing in NestJS, use a global HTTP interceptor to create Sentry transactions and propagate trace headers across RabbitMQ, Kafka, and inter-service HTTP requests for end-to-end visibility.

How does AsyncLocalStorage maintain request context for NestJS logging?

AsyncLocalStorage maintains per-request session context in NestJS by storing data throughout the asynchronous call chain, enabling Winston logs and Sentry breadcrumbs to be enriched with unified trace insights without explicit parameter passing.

Can I automatically create Sentry spans for NestJS method executions?

Yes, you can automatically create and chain Sentry spans for method executions by applying a decorator-driven tracing pattern, specifically using the @LogExecution decorator to instrument functions without manual span management.

What is the best way to correlate logs across NestJS microservices with Sentry and Winston?

The best way to correlate logs across NestJS microservices is using a Sentry Winston transport combined with AsyncLocalStorage, injecting trace IDs into logs and sending them as Sentry breadcrumbs for centralized debugging.

Does this NestJS observability approach support trace propagation through RabbitMQ and Kafka?

Yes, this observability approach supports inter-service messaging by extracting and propagating trace headers when publishing or consuming messages through RabbitMQ and Kafka, ensuring continuous distributed trace chains.