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

@devfellowship/observability

v2.2.2

Published

Browser observability SDK — OpenTelemetry + Sentry for React apps

Readme

@devfellowship/observability

Browser observability SDK for React apps. Provides OpenTelemetry tracing, metrics, Sentry error tracking, Web Vitals, fetch instrumentation, error boundaries, and React Query error reporting — all via a single provider wrapper.

Install

npm install @devfellowship/observability

Peer dependencies

  • react >= 18
  • @tanstack/react-query >= 5 (optional — enables automatic query error reporting)

Quick start

Wrap your app with <ObservabilityProvider>:

import { ObservabilityProvider } from "@devfellowship/observability";

function App() {
  return (
    <ObservabilityProvider>
      <YourApp />
    </ObservabilityProvider>
  );
}

With zero props, the provider reads configuration from Vite environment variables:

| Env var | Purpose | |---------|---------| | VITE_APP_NAME | Service name for traces/metrics | | VITE_APP_VERSION | Service version | | VITE_OTEL_API_KEY | API key sent as x-api-key header | | VITE_SENTRY_DSN | Sentry DSN (enables error tracking. Session replay is OFF.) | | VITE_GIT_SHA | Git SHA of the build. Becomes the Sentry release. Falls back to VITE_COMMIT_SHA, then <app>@<version>. | | VITE_OTEL_ENABLED | Set to "true" to enable (auto-enabled in production). A build opened on a loopback host still sends nothing unless VITE_OTEL_ALLOW_LOOPBACK is "true". | | VITE_OTEL_ALLOW_LOOPBACK | Set to "true" to export from a loopback host (localhost, *.localhost, 127.0.0.0/8, 0.0.0.0, ::1). Default off: a production build opened on a developer machine or a fixture server sends no traces and no Sentry events. |

Explicit configuration

All settings can be passed as props, overriding env vars:

<ObservabilityProvider
  serviceName="my-app"
  serviceVersion="1.2.0"
  collectorUrl="https://otel.devfellowship.com"
  apiKey="your-api-key"
  sentryDsn="https://[email protected]/yyy"
  environment="production"
  enabled={true}
  enableWebVitals={true}
  enableQueryTracking={true}
  enableFetchTracing={true}
>
  <App />
</ObservabilityProvider>

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | serviceName | string | VITE_APP_NAME or "unknown" | Service name for OTel resource | | serviceVersion | string | VITE_APP_VERSION or "0.0.0" | Service version | | collectorUrl | string | "https://otel.devfellowship.com" | OTel collector base URL | | apiKey | string | VITE_OTEL_API_KEY | API key header value | | sentryDsn | string | VITE_SENTRY_DSN | Sentry DSN (omit to disable Sentry) | | environment | string | "production" / "development" | Environment label | | enabled | boolean | true in production, except on a loopback host | Master kill-switch. An explicit value wins in both directions (true exports even on localhost). | | enableWebVitals | boolean | true | Capture LCP, CLS, INP, TTFB | | enableQueryTracking | boolean | true | Report React Query errors as spans | | enableFetchTracing | boolean | true | Auto-trace all fetch() calls |

Utilities

Track custom events

import { trackEvent } from "@devfellowship/observability";

trackEvent("button_click", { "button.id": "checkout", page: "/cart" });

Set user context

import { setUserId, setUserRole } from "@devfellowship/observability";

// After authentication
setUserId(user.id);
setUserRole(user.role);

Sentry helpers

import { captureError, setSentryUser } from "@devfellowship/observability";

captureError(new Error("something broke"), { component: "Checkout" });
setSentryUser(user.id, user.role);

Error boundary

import { ErrorBoundary } from "@devfellowship/observability";

<ErrorBoundary fallback={<p>Something went wrong</p>}>
  <RiskyComponent />
</ErrorBoundary>

What's included

  • OTel traces — BatchSpanProcessor → OTLP/HTTP exporter
  • OTel metrics — PeriodicExportingMetricReader → OTLP/HTTP exporter
  • Fetch instrumentation — auto-creates spans for all fetch() calls (collector URLs filtered)
  • Web Vitals — LCP, CLS, INP, TTFB reported as OTel histogram metrics
  • Sentry — error tracking and browser tracing, with scrubbing (see Privacy). No session replay.
  • Error boundary — catches React component errors, reports to both OTel and Sentry
  • React Query integration — subscribes to query cache, creates error spans on failures
  • Resource attributes — browser, OS, device type, session ID, viewport, connection type, route

Privacy (Sentry)

Since 2.2.0 the Sentry client is built to leak no personal data (plan 20261101-fleet-observability-error-loop, T1):

  • No session replay. No replay integration, and both replay sample rates are 0. Do not add it back without a new privacy decision.
  • Anonymous user. The Sentry user is a random id per browser (localStorage key dfl_obs_anon_id). setSentryUser(id, role) keeps the signature but ignores id: no account id, email or name is sent.
  • Scrubbing. beforeSend, beforeSendTransaction and beforeBreadcrumb remove emails, URL query strings and fragments, JWTs, bearer tokens, key=value secrets and IPv4 addresses from messages, request data, headers, breadcrumbs and span data. Cookies, Authorization and similar headers are dropped. See src/lib/scrub.ts.
  • Fail closed, never throw. The three hooks use scrubEventOrDrop and scrubBreadcrumbOrDrop. A getter-only property (seen 2026-11-04) is read and written safely. When a value needs scrubbing and its property cannot take the new value, the event or crumb is dropped, a console.warn names the key (never the value), and nothing is sent half scrubbed. A hook that threw was reported by the SDK as a new error and lost the transaction.
  • IP address. sendDefaultPii is false; with it the SDK sets infer_ip: "never". There is no scrubIPAddresses SDK option in @sentry/react 10.x. "Prevent Storing of IP Addresses" is a Sentry project setting and must be on in the project (dfl-react). The SDK never sends an IP, and a test checks it.
  • Release. Set VITE_GIT_SHA (or the release prop) at build time, so a release changes at each deploy.

Tests: npm test (unit, with fixtures). Real-browser proof of "no replay envelope": PLAYWRIGHT_PATH=<path to playwright/index.mjs> npm run proof:browser.

Development

npm install
npm run build    # builds with tsup (ESM + .d.ts)

Publishing

npm version patch  # or minor/major
npm publish

License

MIT