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

@senzops/apm-worker

v1.0.7

Published

Cloudflare Worker / Serverless APM SDK for Senzor

Readme

@senzops/apm-worker

The official Serverless & Worker SDK for Senzor APM.

Designed specifically for Cloudflare Workers, Cloudflare Pages, Nitro, and modern Edge runtimes.

✨ Features

  • Zero-Config Auto-Instrumentation: Automatically captures all global fetch calls.
  • Context Propagation: Uses AsyncLocalStorage (via nodejs_compat) to track requests across async boundaries without manual passing.
  • Lightweight: < 5KB gzip, zero external dependencies.
  • Non-Blocking: Uses ctx.waitUntil to flush data without adding latency to user responses.
  • W3C Trace Context: Automatically injects traceparent headers into outgoing requests for distributed tracing.

📦 Installation

npm install @senzops/apm-worker

🚀 Quick Start (Cloudflare Workers)

1. Enable Node Compatibility

Add the nodejs_compat flag to your wrangler.toml. This is required for the SDK to track context across async fetch calls.

# wrangler.toml
compatibility_flags = [ "nodejs_compat" ]
compatibility_date = "2024-09-23"

2. Integrate the SDK

Initialize Senzor in the global scope and wrap your fetch handler.

import { Senzor } from "@senzops/apm-worker";

Senzor.init({
  apiKey: "sz_apm_...",
});

export default {
  fetch: Senzor.worker(async (request, env, ctx) => {
    return new Response("Hello World!");
  }),
};

⚡ Usage with Nitro / Nuxt

For Nitro (standalone) or Nuxt, use a server plugin to instrument the entire application globally without wrapping individual handlers.

1. Create a Plugin

Create server/plugins/senzor.ts:

import { Senzor } from "@senzops/apm-worker";

export default defineNitroPlugin((nitroApp) => {
  // 1. Initialize
  // Use process.env or runtime config if available
  Senzor.init({
    apiKey: process.env.SENZOR_API_KEY || "sz_apm_...",
  });

  // 2. Register Global Instrumentation
  Senzor.nitroPlugin(nitroApp);
});

2. Configuration

Ensure nodejs_compat is enabled in your nitro.config.ts:

// nitro.config.ts
export default defineNitroConfig({
  cloudflare: {
    wrangler: {
      compatibility_flags: ["nodejs_compat"],
    },
  },
});

That's it! Every request to your Nitro app is now traced, and any fetch calls made within your API routes will automatically appear as spans in the trace.


📋 Production Checklist

1. Environment Variables

For security, do not commit your API key.

  1. Run npx wrangler secret put SENZOR_API_KEY.
  2. Update your worker to initialize lazily or use build-time variables.

2. Distributed Tracing

If your Worker calls other services (like a backend API), this SDK automatically adds the traceparent header. Ensure your backend services (Node.js, Python, Go) are configured to extract this header to see a connected trace from Edge -> Backend.

3. Error Tracking

Any uncaught exception thrown in your handler is automatically captured, logged, and reported to Senzor with the stack trace.