Skip to content

feat(nestjs): add instrumentation for NestJS microservice#3435

Open
neilime wants to merge 1 commit intoopen-telemetry:mainfrom
neilime:feat/nestjs-instrument-microservice
Open

feat(nestjs): add instrumentation for NestJS microservice#3435
neilime wants to merge 1 commit intoopen-telemetry:mainfrom
neilime:feat/nestjs-instrument-microservice

Conversation

@neilime
Copy link
Contributor

@neilime neilime commented Mar 13, 2026

Which problem is this PR solving?

  • NestJS instrumentation currently only covers the core HTTP/controller lifecycle through @opentelemetry/instrumentation-nestjs-core, so Nest microservice applications and hybrid apps do not produce dedicated spans for microservice bootstrapping or message/event handlers.
  • This change adds first-class NestJS microservice instrumentation while keeping the existing core-only package available as a compatibility path for current users.

Short description of the changes

  • Add a new @opentelemetry/instrumentation-nestjs package that instruments both Nest HTTP controllers and Nest microservice handlers.
  • Create spans for standalone and hybrid microservice startup (NestFactory.createMicroservice and app.connectMicroservice) and for message/event handler execution.
  • Add Nest-specific attributes for microservice tracing, including handler callback, pattern, and transport information.
  • Keep @opentelemetry/instrumentation-nestjs-core as a deprecated compatibility wrapper that delegates to the new package with microservice instrumentation disabled.
  • Register the new package in @opentelemetry/auto-instrumentations-node and update the related README/docs.
  • Add tests covering HTTP behavior, standalone microservices, and hybrid microservices.

Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
@github-actions
Copy link
Contributor

This package does not have an assigned component owner and is considered unmaintained. As such this package is in feature-freeze and this PR will be closed with 14 days unless a new owner or a sponsor (a member of @open-telemetry/javascript-approvers) for the feature is found. It is the responsibility of the author to find a sponsor for this feature.
Are you familiar with this package? Consider becoming a component owner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:auto-instrumentations-node pkg:instrumentation-nestjs-core pkg-status:unmaintained:autoclose-scheduled pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants