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

@aicrew/openclaw-otel-patch

v1.2.0

Published

OpenClaw OTEL diagnostics patches - fixes bundler listener isolation + adds gen_ai.completion spans

Downloads

118

Readme

@aicrew/openclaw-otel-patch

Patches for OpenClaw's diagnostics-otel plugin to fix telemetry export and add GenAI semantic convention spans.

What It Fixes

1. Bundler Listener Isolation (Critical)

The tsdown bundler duplicates diagnostic-events.ts into 5+ separate JS chunks, each with its own listeners Set. The gateway emits events into one copy, but the OTEL plugin subscribes via a different copy — so events never reach the plugin.

Fix: Share listeners via globalThis.__openclaw_diag_listeners.

Related: openclaw/openclaw#5190, PR #11168

2. GenAI Semantic Convention Spans

Adds gen_ai.completion trace spans following the OpenTelemetry GenAI Semantic Conventions, including:

  • gen_ai.system, gen_ai.response.model, gen_ai.request.model
  • gen_ai.usage.input_tokens, gen_ai.usage.output_tokens
  • gen_ai.usage.cache_read_tokens, gen_ai.usage.cache_write_tokens
  • openclaw.cost.usd

Related: PR #11100

Compatibility

  • Base: OpenClaw v2026.2.18 (fa4772b4ce)
  • Node.js: 22+

Usage

# Install globally
npm install -g @aicrew/openclaw-otel-patch

# Apply to your OpenClaw installation
openclaw-otel-patch ~/openclaw

# Hard restart (required — SIGUSR1 won't reinitialize OTEL SDK)
openclaw gateway stop && openclaw gateway start

Required Config

Add to ~/.openclaw/openclaw.json:

{
  "diagnostics": {
    "enabled": true,
    "otel": {
      "enabled": true,
      "endpoint": "https://your-otlp-endpoint",
      "protocol": "http/protobuf",
      "serviceName": "your-service-name",
      "traces": true,
      "metrics": true,
      "logs": true,
      "flushIntervalMs": 5000
    }
  },
  "models": {
    "providers": {
      "anthropic": {
        "models": [
          { "id": "claude-opus-4-6", "cost": { "input": 15, "output": 75, "cacheRead": 1.5, "cacheWrite": 18.75 } },
          { "id": "claude-sonnet-4-6", "cost": { "input": 3, "output": 15, "cacheRead": 0.3, "cacheWrite": 3.75 } },
          { "id": "claude-haiku-3-5", "cost": { "input": 0.8, "output": 4, "cacheRead": 0.08, "cacheWrite": 1 } }
        ]
      }
    }
  }
}

Metrics Exported

| Metric | Description | |--------|-------------| | openclaw.tokens | Token counts by type (input/output/cache_read/cache_write/total) | | openclaw.cost.usd | Estimated USD cost per model call | | openclaw.run.duration_ms | Agent run duration | | openclaw.context.tokens | Context window usage | | openclaw.message.queued | Messages queued | | openclaw.message.processed | Messages processed by outcome | | openclaw.queue.depth | Queue depth | | openclaw.queue.lane.enqueue | Lane enqueue events | | openclaw.session.state | Session state transitions |

Traces Exported

| Span | Description | |------|-------------| | gen_ai.completion | GenAI semantic convention span with token/cost attributes | | openclaw.model.usage | Legacy span with session/token details | | openclaw.webhook.processed | Webhook processing spans | | openclaw.message.processed | Message processing spans |

⚠️ Notes

  • Dist patches are fragile — re-run after any pnpm build or OpenClaw update
  • The resource attributes (agent ID, org ID) are hardcoded — edit service.ts for your own values
  • Once PR #11168 merges, the dist patch becomes unnecessary
  • Once PR #11100 merges, the gen_ai spans will be built-in with full tool tracing

License

MIT