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

acture-telemetry

v1.1.0

Published

acture telemetry adapter — observe every dispatch via a configurable sink. Optional pass-through redact and sampler callbacks. Errors-as-data preserved end-to-end.

Downloads

19

Readme

acture-telemetry

acture is a development tool first. This package is an optional accelerator — an agent can hand-write this integration into your project instead, with no acture-* dependency. Installing it is a deliberate, opt-in choice to reuse tested code rather than own it. See docs/positioning.md. The agent-written equivalent is docs/hand-written-telemetry.md.

Telemetry adapter for acture. Observes every dispatch and forwards a structured record to a configurable sink. Errors-as-data preserved end-to-end — failed dispatches appear in telemetry with their error code, not as exceptions.

Install

pnpm add acture-telemetry

Use

import { instrumentTelemetry, consoleSink } from 'acture-telemetry';
import { registry } from './registry';

const stop = instrumentTelemetry(registry, {
  sink: consoleSink,
});

// later, on teardown:
stop();

consoleSink is a one-line summary printer ([acture] app.foo ok 1.2ms). For real apps, pass your own sink — a structured logger, a network beacon, an OpenTelemetry exporter:

import { instrumentTelemetry } from 'acture-telemetry';
import { logger } from './my-logger';

instrumentTelemetry(registry, {
  sink: (record) => {
    logger.info({
      cmd: record.commandId,
      ok: record.result.ok,
      ms: record.durationMs,
      ...(record.result.ok ? {} : { error: record.result.error }),
    });
  },
});

The record shape

Every sink receives the same closed, minimal record:

interface TelemetryRecord {
  readonly seq: number;        // monotonic in-process id
  readonly ts: number;          // Date.now() at sink time
  readonly commandId: string;   // even if unknown to the registry
  readonly params: unknown;     // what the caller passed
  readonly ctx: Context;        // dispatch ctx (defaults to {})
  readonly result: Result<unknown>;  // full Result — errors-as-data
  readonly durationMs: number;  // dispatch in → resolved
}

result is the full Result<unknown> from the dispatcher. A failed dispatch arrives as { ok: false, error: { code, message, details? } } — the sink sees the same shape every other surface sees (palette, hotkeys, AI, MCP).

Optional sampler and redact

Both are simple callbacks — same shape as sink. No mini-DSL:

instrumentTelemetry(registry, {
  sink: mySink,
  // Drop dev-only dispatches AND ratio-sample the rest at 10%.
  sampler: (record) =>
    !record.commandId.startsWith('app.dev.') && Math.random() < 0.1,
  // Strip secrets from `params` before any sink sees them.
  redact: (record) => ({
    ...record,
    params: stripSecrets(record.params),
  }),
});

Order of operations: samplerredactsink. A sampler returning false drops the record before redact runs (no point redacting what won't be emitted). Each callback is wrapped in try/catchtelemetry never breaks dispatch: a throwing sink/sampler/redact is swallowed and dispatch returns its Result<R> unchanged.

Composing sinks

There is one built-in sink, deliberately. To fan out to multiple destinations, compose on the user side rather than installing the instrument twice:

instrumentTelemetry(registry, {
  sink: (r) => {
    consoleSink(r);
    otelSink(r);
    networkBeaconSink(r);
  },
});

This is the "translate, don't decide" pattern applied inward: the package doesn't own a sink list, an order, a failure-handling policy across sinks, or a parallel-vs-serial choice — those are host decisions.

Composition with other instrumenters

acture-telemetry follows the same monkey-patch-dispatch pattern as acture-devtools (instrumentRegistry, enableTierWarnings) and acture-undo. Multiple instrumenters wrap each other at install time, in install order. Dispose in reverse install order — disposing an outer wrapper while inner wrappers still reference its captured dispatch will leave dangling wrappers on the registry.

In practice, instrumenters are installed once at host boot and never disposed, so this rarely matters. Tests that install + dispose between cases should still respect the reverse-order rule.

Idempotency

Calling instrumentTelemetry(registry, ...) twice on the same registry returns the same disposer; the second call's options are ignored. Use sink-level composition (above) instead of repeat installation.

See also