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

@outray/observability

v0.1.4

Published

OpenTelemetry SDK for sending Node.js traces, logs, and metrics to OutRay

Readme

@outray/observability

OutRay's Node.js OpenTelemetry distribution. It sends traces, structured logs, and metrics to OutRay over OTLP/HTTP protobuf and automatically instruments common Node.js frameworks, clients, databases, and loggers.

Install

npm install @outray/observability

Create an API token in OutRay with the Send observability data permission. Keep this server-side: the token must never be bundled into browser code.

Configure in code

OpenTelemetry must load before HTTP servers, frameworks, database clients, and loggers. Make OutRay the first thing your server bootstrap starts, then import the application:

// bootstrap.ts
import { startOutrayObservability } from "@outray/observability";

export const observability = startOutrayObservability({
  apiKey: "outray_your_observability_token",
  serviceName: "checkout-api",
  serviceVersion: "1.4.0",
  environment: "production",
  captureConsole: true,
});

await import("./server.js");

Run that bootstrap with an ordinary node dist/bootstrap.js script. Pass the token directly as shown, but do not commit a real token to source control. Production code can supply the same apiKey option from OutRay Secrets, a deployment platform, or another server-side config source; no particular environment-variable name is required.

captureConsole: true sends console.debug, console.info, console.log, console.warn, and console.error to OutRay while preserving their normal local output. Capture is off by default. Values are bounded and common secret, credential, cookie, and authorization fields are redacted before export.

The endpoint defaults to https://ingest.outray.dev. The package still supports environment-variable defaults and @outray/observability/register as an optional zero-code compatibility mode, but framework adapters do not require them.

For route-aware TanStack Start spans and opt-in request/response capture, use the server entry provided by @outray/tanstack-start.

Custom telemetry

For ordinary application logging, use the methods returned by initialization:

observability.info("payment accepted", { orderId: "order_123" });
observability.warn("payment retry scheduled", { attempt: 2 });
observability.error("payment failed", error, { orderId: "order_123" });

These methods keep writing to the local console and also emit structured OTLP logs. Active trace and span context is attached by OpenTelemetry, so logs can be viewed alongside the request or job that produced them. A singleton is also available when passing the initialized object around is inconvenient:

import outray from "@outray/observability";

outray.error("background job failed", error);

Use withOutraySpan for application operations that are not already instrumented. It joins the active request trace, records thrown errors, and always closes the span:

import { withOutraySpan } from "@outray/observability";

const order = await withOutraySpan(
  "db findOne order",
  () => database.orders.findOne({ id: orderId }),
  { attributes: { "db.system.name": "postgresql" } },
);

Use the lower-level OpenTelemetry accessors when you need custom metrics or complete control over a span or log record:

import {
  getOutrayLogger,
  getOutrayMeter,
  getOutrayTracer,
} from "@outray/observability";

const tracer = getOutrayTracer();
await tracer.startActiveSpan("charge-card", async (span) => {
  try {
    await chargeCard();
  } finally {
    span.end();
  }
});

getOutrayLogger().emit({
  severityText: "INFO",
  body: "payment accepted",
  attributes: { "payment.provider": "paystack" },
});

getOutrayMeter().createCounter("orders.created").add(1);

Pino, Winston, HTTP, Fetch/Undici, Express, NestJS, PostgreSQL, Redis, and many other common Node.js libraries are automatically instrumented. OpenTelemetry must start before those packages are imported.

Shutdown

Flush telemetry as part of the application's existing shutdown path:

await observability.shutdown();

The SDK does not install signal handlers or call process.exit, so it does not take ownership of application lifecycle.