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-http-otel

v0.2.0

Published

OpenTelemetry tracing middleware and W3C trace propagation for @spilne/perfect-http.

Readme

@spilne/perfect-http-otel

Drop-in OpenTelemetry tracing for @spilne/perfect-http. Two integration points that compose independently: tracingMiddleware starts a CLIENT span per request with semantic HTTP attributes, and TracingFetchTransport injects W3C traceparent / tracestate headers so downstream services join the trace from the active context. The middleware does not activate its own span; the propagated context is whatever the application made active. Configure an OpenTelemetry provider and propagator before using these integrations.

This package is HTTP-specific. For the general bridge — running @spilne/perfect-core's Tracer service and MetricsRegistry on OpenTelemetry — use @spilne/perfect-otel.

Install

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

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

Quickstart

import { DefaultHttpClient } from "@spilne/perfect-http";
import { tracingMiddleware, tracingTransport } from "@spilne/perfect-http-otel";

const client = new DefaultHttpClient({
  baseUrl: "https://api.example.com",
  transport: tracingTransport, // W3C traceparent injection
  middleware: [tracingMiddleware()], // CLIENT span per request
});

await client.get("/users/1", undefined, { tag: "user.lookup" }).orDie().run();
// span "GET https://api.example.com/users/1", kind CLIENT:
//   http.request.method = "GET"
//   http.route          = "user.lookup"   (the low-cardinality request tag)
//   http.response.duration_ms, url.full
// Non-OK status errors also record http.response.status_code.

The default tracer is trace.getTracer("@spilne/perfect-http"); pass your own via tracingMiddleware({ tracer }). On error the span status flips to ERROR, the status code is recorded, and error.type carries the typed error tag ("HttpStatusError", "HttpTimeoutError", …) for filtering.

Redaction

URL queries are stripped from url.full by default (includeQuery: true opts back in). Paths, fragments, and error messages are not sanitized, so this is not a guarantee that spans contain no sensitive data. The middleware does not currently record headers. Apply redactHeaders explicitly when custom instrumentation records them:

import { makeRedaction, redactHeaders } from "@spilne/perfect-http-otel";

const policy = makeRedaction({ extra: ["x-secret"] });
redactHeaders({ Authorization: "Bearer xyz", "X-Secret": "shh" }, policy);
// → { Authorization: "<redacted>", "X-Secret": "<redacted>" }

Features

  • tracingMiddleware(opts?)HttpMiddleware; CLIENT span per request with semantic HTTP attributes; options for tracer, redaction, includeQuery, spanName, and a disable predicate
  • TracingFetchTransport — wraps any HttpTransport, injects traceparent / tracestate
  • tracingTransport — the default instance, wrapping FetchTransport
  • defaultRedaction / makeRedaction / redactHeaders / redactUrl — pluggable RedactionPolicy

Links