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

autotel-sentry

v0.5.11

Published

Bridge OpenTelemetry (Autotel) traces to Sentry via SpanProcessor and Propagator

Readme

autotel-sentry

Convenience helpers for sending Autotel (OpenTelemetry) traces to Sentry via OTLP. The package parses a Sentry DSN into the OTLP endpoint and auth headers that Autotel's init() expects, and installs a global Sentry event processor that attaches the active OTel trace_id and span_id to every Sentry error event so errors and traces are linked in the Sentry UI.

Prerequisites

  • Node.js 22+
  • @sentry/node >= 10.47.0 (exposes getGlobalScope)
  • autotel (peer dependency)

Installation

pnpm add autotel autotel-sentry @sentry/node

Quick start

import * as Sentry from '@sentry/node';
import { init, shutdown, trace } from 'autotel';
import { linkSentryErrors, sentryOtlpConfig } from 'autotel-sentry';

const config = sentryOtlpConfig(process.env.SENTRY_DSN!);

// 1. Initialize Sentry — tell it not to register its own OTel SDK
Sentry.init({ dsn: config.dsn, skipOpenTelemetrySetup: true });

// 2. Initialize Autotel — it owns OTel and exports traces to Sentry's OTLP endpoint
init({ service: 'my-app', endpoint: config.endpoint, headers: config.headers });

// 3. Link Sentry errors to the active OTel trace
linkSentryErrors(Sentry);

skipOpenTelemetrySetup: true is required because Sentry SDK v8+ registers its own OTel SDK internally. Autotel owns OTel setup; without this flag you get duplicate span processors and broken traces.

API reference

sentryOtlpConfig(dsn: string): SentryOtlpConfig

Parses a Sentry DSN and returns the three values needed to wire Autotel to Sentry's OTLP ingestion endpoint.

const config = sentryOtlpConfig('https://<key>@o<org>.ingest.sentry.io/<project>');
// config.dsn      — normalized DSN string (pass to Sentry.init)
// config.endpoint — OTLP base URL (pass to Autotel init as `endpoint`)
// config.headers  — auth headers (pass to Autotel init as `headers`)

Throws if the DSN is missing or cannot be parsed.

linkSentryErrors(sentry: SentryLinkable): void

Installs a global Sentry event processor that reads the active OTel span from @opentelemetry/api and merges trace_id and span_id into every outgoing Sentry event's contexts.trace. Call this once, after both Sentry.init() and init().

Type: SentryOtlpConfig

interface SentryOtlpConfig {
  dsn: string;                       // Normalized DSN for Sentry.init
  endpoint: string;                  // OTLP base endpoint (Autotel appends /v1/traces)
  headers: Record<string, string>;   // Auth headers for OTLP requests
}

Type: SentryLinkable

Minimal interface required by linkSentryErrors(). @sentry/node >= 10.47.0 satisfies it automatically.

interface SentryLinkable {
  getGlobalScope(): {
    addEventProcessor(fn: (event: Record<string, unknown>) => Record<string, unknown>): void;
  };
}

Migration from SpanProcessor approach

Earlier versions of this package used a SentrySpanProcessor / SentryPropagator bridge that relied on deprecated Sentry Hub APIs. That approach is removed.

Sentry SDK v8+ ships with its own OTel SDK internally. The recommended path is now to let Autotel own OTel and export traces directly to Sentry's OTLP endpoint — no custom span processor needed. Remove any references to createSentrySpanProcessor, SentrySpanProcessor, SentryPropagator, and instrumenter: 'otel' from your setup and replace them with the quick start above.

References