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

@nuvix/telemetry

v1.0.2

Published

A lightweight and extensible telemetry system with adapter-based architecture for collecting performance metrics, supporting OpenTelemetry integration and multiple telemetry backends.

Readme

Nuvix Telemetry 📊

A lightweight and extensible telemetry system with adapter-based architecture for collecting performance metrics, supporting OpenTelemetry integration and multiple telemetry backends.

🚀 Features

  • Adapter System – Easily switch between telemetry providers with a unified interface.
  • OpenTelemetry Ready – Full OpenTelemetry integration with OTLP HTTP exporter.
  • Multiple Metric Types – Counters, Gauges, Histograms, and UpDownCounters.
  • Async Support – Collect and export telemetry data asynchronously.
  • TypeScript First – Full TypeScript support with comprehensive type definitions.

📦 Installation

npm install @nuvix/telemetry

The package supports both CommonJS and ES modules, with automatic format detection based on your project setup.

🛠 Usage

1️⃣ Using OpenTelemetry Adapter

import { OpenTelemetry } from "@nuvix/telemetry";

const telemetry = new OpenTelemetry(
  "http://localhost:4318/v1/metrics", // OTLP endpoint
  "my-service-namespace",
  "my-service",
  "instance-1",
);

// Create different metric types
const requestCounter = telemetry.createCounter(
  "http_requests_total",
  "requests",
  "Total number of HTTP requests",
);

const responseTimeHistogram = telemetry.createHistogram(
  "http_request_duration_ms",
  "ms",
  "HTTP request duration in milliseconds",
);

const activeConnectionsGauge = telemetry.createGauge(
  "active_connections",
  "connections",
  "Number of active connections",
);

const queueSizeUpDownCounter = telemetry.createUpDownCounter(
  "queue_size",
  "items",
  "Number of items in queue",
);

// Record metrics
requestCounter.add(1, { method: "GET", route: "/api/users" });
responseTimeHistogram.record(150, { method: "GET", status: "200" });
activeConnectionsGauge.record(42);
queueSizeUpDownCounter.add(5); // Add items to queue
queueSizeUpDownCounter.add(-2); // Remove items from queue

// Collect metrics
await telemetry.collect();

2️⃣ Using None Adapter (No-op)

import { None } from "@nuvix/telemetry";

// Useful for testing or when telemetry is disabled
const telemetry = new None();

const counter = telemetry.createCounter("test_counter");
counter.add(1); // No-op, does nothing

await telemetry.collect(); // Always returns true

� Available Adapters

| Adapter | Description | Use Case | | --------------- | ------------------------------------------------------ | -------------------------- | | OpenTelemetry | Full OpenTelemetry integration with OTLP HTTP exporter | Production monitoring | | None | No-op adapter that discards all metrics | Testing/disabled telemetry |

📊 Metric Types

The library supports all standard OpenTelemetry metric types:

Counter

Monotonically increasing values (e.g., request count, error count).

const counter = adapter.createCounter(
  "requests_total",
  "requests",
  "Total requests",
);
counter.add(1, { endpoint: "/api/data" });

Histogram

Statistical distribution of values (e.g., request duration, response size).

const histogram = adapter.createHistogram(
  "request_duration",
  "ms",
  "Request duration",
);
histogram.record(123.45, { method: "POST" });

Gauge

Point-in-time values that can go up or down (e.g., memory usage, temperature).

const gauge = adapter.createGauge(
  "memory_usage",
  "bytes",
  "Current memory usage",
);
gauge.record(1024 * 1024 * 512); // 512MB

UpDownCounter

Values that can increase or decrease (e.g., active connections, queue size).

const upDownCounter = adapter.createUpDownCounter(
  "active_sessions",
  "sessions",
  "Active user sessions",
);
upDownCounter.add(1); // User logged in
upDownCounter.add(-1); // User logged out

🏗️ Architecture

The library uses an adapter pattern to provide a unified interface for different telemetry backends:

┌─────────────────┐    ┌──────────────┐    ┌─────────────────┐
│   Application   │───▶│   Adapter    │───▶│   Backend       │
│                 │    │  Interface   │    │ (OpenTelemetry) │
└─────────────────┘    └──────────────┘    └─────────────────┘

The Adapter interface defines methods for creating different metric types:

  • createCounter() - For monotonically increasing values
  • createHistogram() - For statistical distributions
  • createGauge() - For point-in-time measurements
  • createUpDownCounter() - For values that can increase/decrease
  • collect() - For triggering metric collection

🧪 Development

# Build the project (generates both CJS and ESM outputs)
npm run build

# Build in watch mode
npm run build:watch

# Clean build artifacts
npm run clean

# Run linting
npm run lint

# Run tests
npm run test

The build process generates:

  • dist/index.cjs.js - CommonJS build
  • dist/index.esm.js - ES modules build
  • dist/index.d.ts - TypeScript declarations
  • Source maps for both builds

📦 Dependencies

  • @opentelemetry/api - OpenTelemetry API
  • @opentelemetry/sdk-metrics - OpenTelemetry SDK for metrics
  • @opentelemetry/exporter-otlp-http - OTLP HTTP exporter

📝 License

Licensed under the BSD 3-Clause License.

🔧 Future Roadmap

  • Additional adapter implementations (Console, Database, HTTP)
  • Advanced metric aggregation features
  • Distributed tracing support
  • Custom exporter configurations

✨ Contributing

Feel free to open an issue or PR! 🚀