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

@scanwarp/instrument

v0.3.0

Published

Zero-config OpenTelemetry auto-instrumentation for Node.js apps monitored by ScanWarp

Readme

@scanwarp/instrument

Zero-config OpenTelemetry auto-instrumentation for Node.js apps monitored by ScanWarp.

When loaded, it automatically traces HTTP requests, database queries (Postgres, MySQL, Redis), and outbound fetch/HTTP calls — with zero code changes.

Quickstart

npm install @scanwarp/instrument

Option 1: --require flag (any Node.js app)

SCANWARP_PROJECT_ID=your-project-id \
  node --require @scanwarp/instrument ./dist/server.js

Option 2: Next.js instrumentation.ts hook

Create instrumentation.ts in your project root:

export async function register() {
  if (process.env.NEXT_RUNTIME === "nodejs") {
    await import("@scanwarp/instrument");
  }
}

Option 3: Import at the top of your entrypoint

import "@scanwarp/instrument";
// ... rest of your app

The import must be the first import in your entrypoint so OpenTelemetry can patch modules before they are loaded.

Environment Variables

| Variable | Required | Default | Description | |---|---|---|---| | SCANWARP_PROJECT_ID | Yes | — | Your ScanWarp project ID | | SCANWARP_SERVER | No | http://localhost:3000 | ScanWarp server URL | | SCANWARP_SERVICE_NAME | No | Auto-detected from package.json name | Service name for traces | | SCANWARP_DEBUG | No | false | Set to true to enable OTel diagnostic logging |

What gets instrumented

Automatically enabled:

  • HTTP — incoming and outgoing http/https requests
  • Express — route-level spans
  • Fastify — route-level spans
  • PostgreSQL (pg) — query spans with statement text
  • MySQL — query spans
  • Redis (ioredis / redis@4) — command spans
  • Fetch / Undici — outbound fetch() and undici requests

Explicitly disabled (noisy, low value):

  • fs — filesystem operations
  • dns — DNS lookups
  • net — raw TCP socket operations

How it works

@scanwarp/instrument initializes the OpenTelemetry Node SDK at import time. It:

  1. Creates an OTLP HTTP trace exporter pointed at your ScanWarp server (/v1/traces)
  2. Creates an OTLP HTTP metric exporter pointed at your ScanWarp server (/v1/metrics)
  3. Registers auto-instrumentations for supported libraries
  4. Attaches scanwarp.project.id as a resource attribute on all telemetry
  5. Flushes pending data on SIGTERM/SIGINT for graceful shutdown

Metrics are exported every 30 seconds. Traces are exported in batches by the SDK's default BatchSpanProcessor.