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

@ultrvlt/browser-rum

v0.2.0

Published

Ultraviolet Observability — browser RUM SDK (Web Vitals, JS errors, fetch timing, session tracking, and session replay) that emits OTLP spans to the Ultraviolet gateway and stitches to backend traces via W3C traceparent.

Downloads

175

Readme

@ultrvlt/browser-rum

Browser Real User Monitoring SDK for Ultraviolet Observability. Captures Core Web Vitals, JavaScript errors, fetch timing and page views, and ships them as OTLP spans to your Ultraviolet ingest gateway — the same pipeline your backend telemetry already uses. Optional session replay (rrweb) records the DOM with privacy masking on by default.

The headline: every instrumented fetch injects a W3C traceparent header, so a browser request and the backend spans it triggers share one trace_id. A slow page action in the RUM view clicks straight through to its server-side waterfall.

Install

npm (bundled apps)

npm install @ultrvlt/browser-rum
import { init } from '@ultrvlt/browser-rum'

const rum = init({
  endpoint: 'https://gateway.example.com', // ingest gateway base URL
  app: 'storefront-web',                   // becomes service.name
  // optional:
  // siteId: 'us-east-1',
  // ingestKey: '<your site ingest key>',  // if the gateway requires one
  // sessionSampleRate: 0.5,               // 0..1, decided once per session
  // propagateTo: [location.origin, 'https://api.example.com'],
})

// once the signed-in user is known:
rum.setUser('user-123')

Script tag (self-hosted / air-gapped)

If you can't pull from npm — or you'd rather not add the SDK to your build — use the prebuilt IIFE bundle. Host dist/ultrvlt-rum.iife.js on your own origin and load it directly; it exposes a global UltrvltRUM:

<script src="/js/ultrvlt-rum.iife.js"></script>
<script>
  UltrvltRUM.init({ endpoint: 'https://gateway.example.com', app: 'storefront-web' })
</script>

init() is idempotent and safe to call at app bootstrap. It returns { setUser, flush, stopReplay }; setUser and flush are also exported standalone.

What it captures

| Signal | How | Notable attributes | |-------------|---------------------------------------|--------------------| | Page views | Navigation Timing + SPA history hooks | url.full, nav.type | | Web Vitals | web-vitals | web_vital.name, web_vital.value | | JS errors | error + unhandledrejection | exception.type, exception.message | | fetch | monkey-patched window.fetch | http.request.method, http.url, http.response.status_code |

Disable any of them:

init({ endpoint, app, instrument: { vitals: false } })

Session replay

Replay is opt-in (it's heavier and the largest privacy surface). Turn it on with replay: true for defaults, or pass an object to tune it:

init({
  endpoint, app,
  replay: {
    enabled: true,
    sampleRate: 0.2,        // fraction of sampled sessions to record; defaults to sessionSampleRate
    maskPreset: 'strict',   // 'strict' (default) | 'balanced' | 'off'
  },
})

Recordings share the session's session.id, so a replay lines up with the same telemetry spans, and upload to the gateway's dedicated replay lane (<endpoint>/v1/rum/replay). Call rum.stopReplay() to end recording early.

Privacy / masking

Masking is on by default — because you self-host, the recorded DOM never leaves your infrastructure, but the SDK still masks aggressively out of the box:

| maskPreset | Inputs | Visible text | Use for | |--------------|--------|--------------|---------| | strict (default) | masked | masked | anything with sensitive data | | balanced | masked | kept | readable layout for debugging | | off | kept | kept | apps with no sensitive data only |

Fine-grained control: maskAllInputs / maskAllText override the preset, and per-element classes let you exclude regions — ultrvlt-block (fully blocked), ultrvlt-mask (text masked), ultrvlt-ignore (no input events). <canvas> is not recorded unless you set recordCanvas: true.

Backend correlation

The SDK targets the gateway's OTLP/HTTP endpoint (<endpoint>/v1/traces) and injects a W3C traceparent on instrumented fetch calls, so browser spans and the backend spans they trigger share one trace_id and land in the same store — the RUM view and the distributed-trace waterfall are the same data. service.name comes from app; session.id and (optional) user.id ride along on every span.

Sessions & sampling

A session groups telemetry under a stable session.id, persisted to sessionStorage. It rolls over on 30 minutes idle or a 4-hour hard cap. Sampling is decided once per session so a sampled session is captured whole and an unsampled one emits nothing — the injected traceparent always agrees with what's exported.

Ingest key

The browser ingest endpoint is internet-facing, so the gateway can require a per-site ingestKey. When set, the SDK presents it on every telemetry and replay upload. It's a throttling credential to deter public abuse — not a strong secret, and it's safe to ship in your page.

Trace-header scope

propagateTo defaults to same-origin, so traceparent is never leaked to third-party hosts. List additional first-party API origins to extend it.

Development

npm test          # node --test — pure-logic unit tests (ids, session, otlp, replay)
npm run build     # esbuild → dist/ (ESM + IIFE) — requires devDeps installed

The test suite runs with no browser and no bundler. Instrumentation modules (src/instrument/*) require a DOM and are exercised in the browser.