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

@elephantroom-jumbo/telemetry

v0.5.0

Published

Batteries-included OpenTelemetry SDK for Jumbo Node services

Readme

@elephantroom-jumbo/telemetry

Batteries-included OpenTelemetry SDK for Jumbo Node services. Wraps @opentelemetry/sdk-node with sane defaults, a Pino logger that forwards to the LGTM stack, HTTP RED metrics, and Cube query tracing — so a service gets traces, metrics, and logs with one init() call.

Install

npm install @elephantroom-jumbo/telemetry

Quick start

init() must run before importing anything else — auto-instrumentation patches modules at import time.

import { init } from '@elephantroom-jumbo/telemetry';
init({ serviceName: 'jumbo-production' }); // first import in the entry point

import { getLogger } from '@elephantroom-jumbo/telemetry';
const log = getLogger('orders');      // Pino child, auto-injects trace_id/span_id
log.info({ orderId }, 'order placed');

Environment

OTEL_EXPORTER_OTLP_ENDPOINT=https://<collector-host>
OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer <token>
NODE_ENV=production            # → deployment.environment.name resource attribute

API

| Export | Purpose | |--------|---------| | init(config) | Start the SDK. Call first. Idempotent. | | getLogger(component) | Pino child logger; trace context auto-injected; forwards to Loki. | | getTracer(name) | Manual OTel tracer for custom spans. | | getMeter(name) | Manual OTel meter for custom metrics. | | metricsMiddleware(options?) | Express middleware: HTTP RED metrics + span-name repair + optional per-user usage attribution. | | wrapCubeQuery(fn) | Wrap a Cube /load call in a traced span. | | shutdown() | Graceful flush — call on SIGTERM. |

HTTP metrics + per-user usage — metricsMiddleware

Mount it after your body parsers (and, if you want user attribution, after your auth middleware — see below):

import { metricsMiddleware } from '@elephantroom-jumbo/telemetry';
app.use(metricsMiddleware());

Records RED metrics (http.server.request.total, .duration, .error.total) and repairs the server span name to the templated route (GET /api/customers/:customerId) so per-request IDs never leak into span names or spanmetrics cardinality.

Opt-in user attribution (resolveUser)

Pass resolveUser to make authed requests attributable to the logged-in user. When it returns a non-null user, the middleware:

  1. tags the request span with enduser.id (and enduser.role when present) — for Tempo trace↔log correlation; and
  2. emits a feature_used log to Loki: { event, user_id, role, http_route, http_method, status_code }.
// auth middleware must run first so req.user is populated
app.use(clerkAuth);
app.use(
  metricsMiddleware({
    resolveUser: (req) =>
      req.user ? { id: String(req.user.id), role: req.user.role } : null,
  }),
);

resolveUser is called at most once per request, at response finish, and must never throw (errors are swallowed). User identity is written only to the span attribute and the feature_used log body (which lands as Loki structured metadata) — never to the RED metric labels, so Prometheus cardinality stays bounded. feature_used is emitted only for authenticated requests that matched a route, so unauthenticated traffic (health checks, login) produces none.

The feature_used event is the per-user usage signal — "who used which feature" — queryable in Loki by user_id + http_route since a given time.

Graceful shutdown

process.on('SIGTERM', async () => { await shutdown(); process.exit(0); });

Development

npm run build       # tsc → dist/
npm run typecheck   # tsc --noEmit
npm test            # node:test + tsx (test/*.test.ts)