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

@sophonz/meta

v0.0.9

Published

Readme

@sophonz/meta

한국어

Metadata and span context utilities for Sophonz instrumentation.

Provides helper functions for screen name management, session ID tracking, and span attribute enrichment.

Part of the Sophonz OpenTelemetry suite.

Install

bun add @sophonz/meta
# or
pnpm add @sophonz/meta
# or
npm install @sophonz/meta

Usage

import {
  getScreenName,
  setScreenAttribute,
  spanResources,
  getTitle
} from '@sophonz/meta';

// Set custom screen name (overrides auto-detection)
setScreenAttribute('CheckoutFlow');

// Get current screen name
const screenName = getScreenName({
  screenNameType: 'full',
  urlWithSearchParams: false
});

// Enrich span with standard attributes
spanResources(span, {
  screenNameType: 'routeOnly',
  urlWithSearchParams: false
});

// Get page title
const title = getTitle(); // e.g., "My App"

API

Screen Name Options

ScreenNameOption, whose screenNameType field is the exported ScreenNameType:

| Field | Values | Description | |------|--------|-------------| | screenNameType | 'routeOnly' | 'titleOnly' | 'full' | How to construct the screen name | | urlWithSearchParams | boolean | Include query strings in URL |

URL redaction

spanResources takes SpanResourcesOption, which is ScreenNameOption plus one field:

| Field | Type | Default | Description | |------|--------|-------------|-------------| | sanitizeUrl | (url: string) => string | defaultSanitizeUrl from @sophonz/redaction | Applied to url.full and to the URL used in app.screen.name |

Redaction is on by default. url.full is written from window.location.href on effectively every span the SDK produces, so without it a query string such as ?token=abc rides along on all of them regardless of urlWithSearchParams. The default sanitizer replaces user:password@ credentials and the values of 19 well-known sensitive parameters with REDACTED, keeping the parameter names and leaving every other byte of the URL untouched.

app.screen.name gets the same treatment. With urlWithSearchParams: false the query string is already stripped, so redaction is a no-op there; with true it is what keeps the query string safe.

A supplied sanitizeUrl replaces the default rather than running after it. To keep the defaults and add your own parameters, build one with createSanitizeUrl({ additionalQueryParamsToScrub }).

A supplied function is called inside a try/catch: if it throws or returns a non-string, the URL is written as the bare string REDACTED and the failure is reported once through diag.warn. Only the default sanitizer's results are memoised, since a supplied one is not known to be pure.

Functions

  • setScreenAttribute(attribute: string) - Override automatic screen name
  • getScreenName(options) - Get current screen name based on options
  • setScreenName(span, options) - Add screen attributes to a span
  • spanResources(span, options?) - Add screen, session, and URL attributes to a span
  • getTitle() - Extract page title from document

Peer Dependencies

  • @opentelemetry/api@^1.9.1

License

See LICENSE in this package.


Part of sophonz-js.