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

@spilne/perfect-otel

v0.2.0

Published

OpenTelemetry bridge for @spilne/perfect-core observability — Tracer spans and metrics export.

Readme

@spilne/perfect-otel

OpenTelemetry bridge for @spilne/perfect-core observability. Two pieces: OtelTracer implements core's Tracer service on top of an OTel tracer, so every withSpan in your program becomes a real OTel span (with correct parentage); OtelMetricsExporter pushes MetricsRegistry snapshots into OTel instruments.

This is the general bridge — it knows nothing about HTTP. For HTTP-specific client tracing (CLIENT spans per request, traceparent propagation on @spilne/perfect-http), use @spilne/perfect-http-otel.

Install

bun add @spilne/perfect-otel @opentelemetry/api

Not yet published to npm — install from the workspace for now.

Quickstart

Tracing

import { trace } from "@opentelemetry/api";
import { provide, run, succeed, withSpan, Tracer } from "@spilne/perfect-core";
import { OtelTracer } from "@spilne/perfect-otel";

const program = withSpan(
  succeed(21).map((n) => n * 2),
  "handle",
  { "app.tenant": "acme" },
);

const tracer = new OtelTracer(trace.getTracer("my-app"));
await run(provide(program, Tracer, tracer));

Span parentage carries over: core's withSpan passes the enclosing Perfect span as the parent, and the bridge maps it back to its OTel span — traces nest identically in both worlds. Typed failures set span status to ERROR and record the exception; interruption sets ERROR with a perfect.interrupted attribute. When no tracer is provided, withSpan is zero-cost.

Metrics

import { metrics } from "@opentelemetry/api";
import { defaultMetricsRegistry } from "@spilne/perfect-core";
import { OtelMetricsExporter } from "@spilne/perfect-otel";

const exporter = new OtelMetricsExporter(metrics.getMeter("my-app"), defaultMetricsRegistry);

// Call on your export cadence — a Stream.tick loop, a
// PeriodicExportingMetricReader callback, a shutdown hook.
exporter.export();

Counters and histograms are exported as deltas between calls, so repeated exports don't double-count; gauges are absolute. export() is safe to call repeatedly and returns the snapshot it exported.

Features

  • OtelTracer — core Tracer service backed by any @opentelemetry/api tracer; parentage, error status, exception recording, interruption marking
  • OtelMetricsExporterCounter / Gauge / Histogram from core's MetricsRegistry mapped to OTel instruments, labels preserved, delta-correct on repeat export

Links

  • Repo: https://github.com/spilne/perfect
  • Core observability APIs (Log, withSpan, Metrics): documentation/15-observability.md
  • HTTP client tracing: @spilne/perfect-http-otel