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

@youneed/otel

v0.2.0

Published

Shared OpenTelemetry setup for @youneed/* framework levels: real OTel SDK (node + web), OTLP/HTTP traces + metrics, W3C propagation helpers, instrumented fetch.

Readme

@youneed/otel

Shared OpenTelemetry setup for all @youneed/* framework levels — the real OTel SDK, owned in one place so level packages never import @opentelemetry/* directly.

  • Node (@youneed/otel/node): startNodeOtel()NodeTracerProvider + BatchSpanProcessor → OTLP/HTTP, MeterProvider + PeriodicExportingMetricReader → OTLP/HTTP, W3C + baggage propagators, AsyncLocalStorage context. Used by the server, cli and test levels.
  • Web (@youneed/otel/web): startWebOtel()WebTracerProvider, same exporters (browser-safe), force-flush on pagehide / tab hidden. Used by the dom level.
  • Env-agnostic core (@youneed/otel): config resolution, span helpers, propagation, instrumentedFetch.

Quick start

import { startNodeOtel } from "@youneed/otel/node";

const handle = startNodeOtel({ serviceName: "api", endpoint: "http://localhost:4318" });
// …app runs…
await handle.shutdown(); // force-flushes spans + metrics

Standard env vars are honored as defaults: OTEL_SERVICE_NAME, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, OTEL_SDK_DISABLED.

start*Otel is a singleton per process (global providers register once); a second call warns and returns the existing handle.

Helpers

| Export | What it does | | --- | --- | | getTracer(scope?) / getMeter(scope?) | Global tracer/meter access | | withSpan(name, attrs, fn) / withSpanAsync(...) | Run fn in an active span; exceptions recorded + ERROR status, span always ends | | recordException(span, err) | Exception event that tolerates non-Error throws | | injectHeaders(headers?) / extractHeaders(headers) | W3C traceparent/tracestate/baggage propagation for plain header records | | instrumentedFetch({ base?, tracer?, spanName? }) | fetch wrapper: CLIENT span per call + header injection. Plug into @youneed/http-client: createClient({ fetch: instrumentedFetch() }) | | useGlobalCounter(name, opts?) / useGlobalHistogram(name, opts?) | Process-wide shared instruments: the same (scope, name, unit) always yields the SAME counter/histogram — declare once at module top and reuse from app code and every test. Created lazily on first use after the SDK starts; a silent no-op before | | createOtelApi({ tracer? }) | The shared this.otel surface (span/spanAsync child spans + counter/histogram globals) that level packages contribute — server otelProvider, dom otelProvider, cli otelCommand, test OtelFixture | | activeSpanContext() / isValidSpanContext(sc) | Active span inspection (used by @youneed/logger-plugin-otel) | | setSpanOnContext(ctx, span) / withContext(ctx, fn) | Explicit context plumbing without importing the api | | resolveConfig(config) / buildResource(config) | Config/env merge and OTel Resource construction | | noopHandle() | Pass-through OtelHandle for the disabled case |

Test hooks

startNodeOtel / startWebOtel accept exporter overrides so tests run without a collector:

import { InMemorySpanExporter } from "@opentelemetry/sdk-trace-base";

const spans = new InMemorySpanExporter();
const handle = startNodeOtel({ serviceName: "test", traceExporter: spans, batch: false });
// batch: false → SimpleSpanProcessor, spans export synchronously on end()

metricExporter / metricReader (e.g. PeriodicExportingMetricReader + InMemoryMetricExporter) do the same for metrics.

Level packages

@youneed/server-plugin-otel · @youneed/cli-plugin-otel · @youneed/dom-provider-otel · @youneed/test-plugin-otel · @youneed/logger-plugin-otel — each wires this core into its framework level. Prefer those over calling start*Otel yourself.

Zero-dep alternative (no OTel SDK): @youneed/server-middleware-trace + @youneed/server-plugin-otlp (server level only).

Build & test

pnpm --filter @youneed/otel run build
pnpm --filter @youneed/otel test