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

@better-webhook/otel

v1.1.0

Published

OpenTelemetry bridge for Better Webhook delivery observability

Downloads

93

Readme

@better-webhook/otel

Record Better Webhook delivery spans with OpenTelemetry-compatible tracers without capturing webhook payload contents by default.

@better-webhook/otel is the OpenTelemetry bridge for Better Webhook Delivery Observability. It implements the telemetry hooks from @better-webhook/core so you can see verification, replay protection, idempotency, handler, and response outcomes for each webhook delivery.

Why use this package?

  • Create one span for each webhook delivery.
  • Attach provider, event, pipeline result, and response attributes.
  • Record sanitized pipeline errors.
  • Avoid recording event payload contents by default.
  • Use a small tracer interface compatible with @opentelemetry/api.

Installation

Install the OpenTelemetry bridge with core and your OpenTelemetry API package:

pnpm add @better-webhook/core @better-webhook/otel @opentelemetry/api

You will usually also install a provider and framework adapter:

pnpm add @better-webhook/stripe @better-webhook/nextjs

Getting started

Pass otel() as the endpoint telemetry implementation:

import { trace } from "@opentelemetry/api";
import { createWebhookEndpoint } from "@better-webhook/core";
import { otel } from "@better-webhook/otel";
import { stripe } from "@better-webhook/stripe";

const endpoint = createWebhookEndpoint({
  provider: stripe({ signingSecret: process.env.STRIPE_WEBHOOK_SECRET! }),
  telemetry: otel({ tracer: trace.getTracer("webhooks") }),
  handlers: {
    "invoice.paid": async ({ event }) => {
      event.payload.status;
    },
  },
});

Configure your OpenTelemetry SDK, exporter, and resource metadata in your application as usual. This package only connects Better Webhook pipeline events to a tracer.

How it fits with Better Webhook

@better-webhook/otel implements core's DeliveryTelemetry contract. Core calls telemetry hooks while processing each Webhook Delivery. The OpenTelemetry bridge turns those hooks into a span named better_webhook.delivery.

This package does not verify providers, adapt framework requests, or change pipeline behavior. It observes the outcome that core produces.

Behavior and safety notes

The bridge records delivery metadata and processing outcomes, not payload contents. This keeps observability useful without putting customer or provider payload data into traces by default.

If core reports an error during event extraction or handler processing, the bridge records sanitized error information on the active delivery span.

If the telemetry context is not an OpenTelemetry-compatible span, finish and error hooks do nothing.

Span attributes

The delivery span starts with:

  • webhook.provider
  • http.request.method
  • url.full

When the delivery finishes, the bridge records:

  • webhook.event.type
  • webhook.event.id
  • webhook.result
  • webhook.verification
  • webhook.replay
  • webhook.idempotency
  • webhook.handler
  • http.response.status_code
  • webhook.duplicate
  • webhook.ignored
  • webhook.rejected
  • webhook.reason

Optional attributes are only set when core has the corresponding value.

API summary

  • otel(options): creates a Better Webhook DeliveryTelemetry implementation.
  • OtelOptions: accepts a tracer.
  • OtelTracer: minimal tracer contract used by the bridge.
  • OtelSpan: minimal span contract used by the bridge.

Runtime support and limits

  • Node.js 18 or newer.
  • ESM-only package with TypeScript declarations.
  • The package expects your application to configure OpenTelemetry SDK/exporter setup separately.
  • Payload recording is not enabled by default.