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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nathapp/nestjs-observability

v3.3.0

Published

First-party metrics (Prometheus) and distributed tracing (OpenTelemetry) for NestJS, joined to the nathapp correlation-id context

Readme

@nathapp/nestjs-observability

First-party metrics (Prometheus) and distributed tracing (OpenTelemetry) for NestJS, joined to the nathapp correlation-id context so logs, metrics, and traces share one id.

Status: scaffolded. Behaviour is implemented per docs/superpowers/specs/2026-07-07-nestjs-observability-design.md — files under lib/** currently throw not implemented and are filled in by the TDD plan.

What it provides

  • RED HTTP metrics — request count, error count, and a duration histogram (labelled method/route/status) via a global interceptor, plus default Node/process metrics.
  • /metrics scrape endpoint — powered by @willsoto/nestjs-prometheus. Path is configurable. Exposure and authz are the consumer's concern (no auth is applied).
  • Distributed tracing — an OpenTelemetry NodeSDK with HTTP + express/fastify auto-instrumentation, OTLP/console exporters, and a configurable sampling ratio.
  • Correlation bridge — the request correlation id (nestjs-logging RequestContextService) is set on each span, and the active trace_id/span_id are written back into the logging context so log lines carry them.
  • Manual spans — a TraceService and a @Trace() method decorator.
  • Custom metricsmakeCounterProvider / makeGaugeProvider / makeHistogramProvider / makeSummaryProvider / InjectMetric are re-exported so you never depend on @willsoto/nestjs-prometheus directly.

Usage

Tracing must start before any framework import, so call initTracing() first in main.ts:

// main.ts — very first lines
import { initTracing } from '@nathapp/nestjs-observability';
initTracing({ serviceName: 'my-api', otlpUrl: process.env.OTLP_URL });

// ...then the normal bootstrap
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

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

Register the module for metrics + in-app trace helpers:

import { ObservabilityModule } from '@nathapp/nestjs-observability';

@Module({
  imports: [
    ObservabilityModule.register({
      metrics: { path: '/metrics', ignoreRoutes: ['/metrics', '/health'] },
      tracing: { correlationBridge: true },
    }),
  ],
})
export class AppModule {}

Peer dependencies

  • @nestjs/common, @nestjs/core, rxjs — the framework.
  • @nathapp/nestjs-loggingsoft; only the correlation bridge uses its RequestContextService. Without it the bridge is inert (everything else still works).

Scope (v1)

Metrics are pure Prometheus; OpenTelemetry is tracing-only. OTel metrics, OTLP logs, DB/Redis/queue instrumentation, exemplars, and dashboards are deferred follow-ups.