@bluealba/opentelemetry-tracer-nestjs
v2.0.1-feature-replace-eslint-prettier-b-297
Published
NestJS module for integrating OpenTelemetry tracing
Maintainers
Readme
OpenTelemetry Tracer for NestJS
Overview
OpenTelemetry Tracer for NestJS integrates robust tracing into your NestJS applications. Built on top of OpenTelemetry, it offers auto-instrumentation and allows custom configuration to monitor performance and troubleshoot issues in your NestJS services.
Installation
Install the package from npm:
npm install @bluealba/opentelemetry-tracer-nestjsUsage
Import the module and initialize tracing in your NestJS application. Add the tracer module to your root module:
import { Module } from '@nestjs/common';
import { OpenTelemetryModule } from '@bluealba/opentelemetry-tracer-nestjs';
@Module({
imports: [
// ...existing modules...
OpenTelemetryModule.forRoot({
tracing: {
global: true,
enabled: !!process.env.TRACE_URL,
url: process.env.TRACE_URL,
serviceName: 'your-nest-service',
},
}),
],
// ...existing providers and controllers...
})
export class AppModule {}Configuration
Configure your tracer with the following options:
- enabled: Toggle tracing on or off.
- url: Specify the OTLP trace exporter endpoint.
- serviceName: Name your service for trace identification.
- logger: (Optional) Custom logger for additional logging.
- global: (Optional) Globally activate the tracking module.
- instrumentations: (Optional) List of instrumentations to enable.
