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

@nifrajs/otel

v3.1.0

Published

Distributed tracing for nifra - W3C traceparent/tracestate propagation + OpenTelemetry-semantic-convention spans via a pluggable exporter. Bridge to the OpenTelemetry SDK or log spans directly; no SDK bundled. Edge-safe.

Readme

@nifrajs/otel

Distributed tracing for nifra. The tracing() plugin continues (or starts) a W3C trace per request, opens an OpenTelemetry-semantic-convention span, and exposes c.trace so you can forward the trace to downstream services. One fail-open lifecycle owns parentage, identity, timing, errors, final status, and exactly-once completion. Pluggable adapters project that observation into the OpenTelemetry SDK, DevTools, private backends, or structured logs. No SDK bundled; edge-safe.

import { tracing, traceHeaders, consoleSpanExporter } from "@nifrajs/otel"

const app = server()
  .use(tracing({ exporter: consoleSpanExporter(), serviceName: "orders-api" }))
  .get("/orders/:id", async (c) => {
    // continue the trace into a downstream call:
    const res = await fetch(`${INVENTORY_URL}/stock`, { headers: traceHeaders(c.trace) })
    return { id: c.params.id, inStock: (await res.json()).ok }
  })

What it does per request

  • Continues an inbound trace - parses the traceparent header; reuses its trace-id and records the inbound span as the parent. No inbound header → starts a fresh trace.
  • Opens a span with HTTP semantic-convention attributes (http.request.method, url.path, http.response.status_code, optional service.name), ended on response with duration + status (error for 5xx, ok otherwise).
  • Exposes c.trace ({ traceId, spanId, parentSpanId?, sampled, traceparent }) - spread traceHeaders(c.trace) into any downstream fetch/ctx.api call to continue the trace.
  • Exposes c.causality - a bounded, payload-free request node that survives durable command, event, workflow, projection, and repair seams. traceHeaders(c.trace, c.causality) forwards both conventions to a trusted downstream service.
  • Exposes c.observation - integrations can start correctly-parented child observations or attach an adapter without rebuilding request lifecycle state.
  • responseHeader: true also sets traceparent on the response (browser/client correlation).

Durable causality and trust

Pass a durable recorder to append the request root before the handler runs. An explicitly configured recorder is correctness evidence, so its failure fails the request closed:

app.use(tracing({
  exporter,
  causality: {
    recorder: durableGraphStore,
    acceptInbound: (request) => verifyInternalServiceCredential(request),
  },
}))

Inbound causality headers are not trusted by default. This prevents an internet client from injecting fake parents into another execution timeline. Supply acceptInbound only at an authenticated service-to-service boundary; a false, thrown, or rejected decision starts a fresh graph. W3C traceparent remains normal observability context, but a fresh durable execution id includes the server-generated span id and is not copied from the untrusted header.

Use causalitySpanLink(context) when durable work opens a later observation. It creates a real OTel link to the nearest observed causal ancestor and drops invalid/unanchored contexts rather than inventing trace identity.

Adapters

Implement ObservationAdapter to send spans wherever you collect them:

interface ObservationAdapter {
  onStart?(span: NifraSpan): void
  onEnd(span: NifraSpan): void
}
  • consoleSpanExporter() - logs each completed span as one structured line (dev / starting point).
  • tracing({ adapters: [devtoolsAdapter, privateAdapter] }) - fan out the same lifecycle; adapter failures are isolated and never alter the response.
  • OpenTelemetry SDK bridge - a ~10-line adapter maps NifraSpan onto a real OTel Span from a Tracer (the attribute names already follow OTel conventions, so they pass straight through). Your app depends on @opentelemetry/*; @nifrajs/otel does not.

Connect your collector

Use traceparent and the built-in semantic attributes in every request span, then send spans to your own collector through an exporter. Keep the package edge-safe by installing the OpenTelemetry SDK only in apps that need that exporter.

For non-HTTP work, createObservationLifecycle() exposes the same state machine directly. Prefer it over hand-rolling traceparent parsing, clocks, error status, or completion guards.

For AI agents

Start with LLM.md - this package's contract card (the exports you call + its footguns), one cheap read instead of the whole corpus. For the wider framework: the repo's AGENTS.md is the copy-paste quick reference, and llms-full.txt is the full machine-readable corpus. Run nifra check as the done-gate, or nifra mcp to give the agent live project tools.