npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@develop-x/nest-tracing

v1.0.4

Published

## Overview

Readme

@develop-x/nest-tracing

Overview

@develop-x/nest-tracing is a NestJS package that provides OpenTelemetry distributed tracing capabilities for your applications. It automatically instruments your Node.js application and exports trace data to OTLP-compatible backends.

Installation

npm install @develop-x/nest-tracing

Features

  • Automatic Instrumentation: Automatically instruments popular Node.js libraries and frameworks
  • OTLP Export: Exports traces to OpenTelemetry Protocol (OTLP) compatible backends
  • Easy Configuration: Simple setup with minimal configuration required
  • Environment Variable Support: Supports standard OpenTelemetry environment variables

Usage

Basic Setup

Initialize tracing at the very beginning of your application, before importing any other modules:

// main.ts or app.ts
import { initializeTracing } from '@develop-x/nest-tracing';

// Initialize tracing before any other imports
await initializeTracing({
  serviceName: 'my-service',
  otlpUrl: 'http://localhost:4318/v1/traces'
});

// Now import your application modules
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  await app.listen(3000);
}
bootstrap();

Configuration Options

interface TracingOptions {
  serviceName: string;    // Name of your service
  otlpUrl?: string;      // OTLP endpoint URL (optional)
}

Environment Variables

The package supports standard OpenTelemetry environment variables:

  • OTEL_EXPORTER_OTLP_ENDPOINT: OTLP endpoint URL
  • SERVICE_NAME: Service name for tracing

Example with Environment Variables

// If environment variables are set, you can use minimal configuration
await initializeTracing({
  serviceName: process.env.SERVICE_NAME || 'my-service'
});

Supported Instrumentations

The package automatically instruments the following libraries:

  • HTTP/HTTPS requests and responses
  • Express.js applications
  • Database drivers (MySQL, PostgreSQL, MongoDB, etc.)
  • Redis clients
  • And many more through @opentelemetry/auto-instrumentations-node

Integration with Observability Platforms

Jaeger

await initializeTracing({
  serviceName: 'my-service',
  otlpUrl: 'http://jaeger:14268/api/traces'
});

Zipkin

await initializeTracing({
  serviceName: 'my-service',
  otlpUrl: 'http://zipkin:9411/api/v2/spans'
});

OpenTelemetry Collector

await initializeTracing({
  serviceName: 'my-service',
  otlpUrl: 'http://otel-collector:4318/v1/traces'
});

Best Practices

  1. Initialize Early: Always initialize tracing before importing any other modules
  2. Service Naming: Use descriptive and consistent service names across your microservices
  3. Environment Configuration: Use environment variables for different deployment environments
  4. Error Handling: The package includes built-in error handling for initialization failures

Troubleshooting

Common Issues

  1. Tracing not working: Ensure tracing is initialized before any other imports
  2. No traces appearing: Check that the OTLP endpoint is accessible and correct
  3. Performance impact: The auto-instrumentation has minimal performance overhead

Debug Mode

To enable debug logging, set the environment variable:

export OTEL_LOG_LEVEL=debug

Dependencies

  • @opentelemetry/sdk-node: OpenTelemetry Node.js SDK
  • @opentelemetry/auto-instrumentations-node: Automatic instrumentation
  • @opentelemetry/exporter-trace-otlp-http: OTLP HTTP trace exporter

License

ISC

Support

For issues and questions, please refer to the project repository or contact the development team.