@aidra/pmx-io

中文文档
9.24.0发布于 2026/11/04UNLICENSEDTypeScriptESM + CJS零依赖近 30 天下载 2118

In-process instrumentation for Node.js and Bun apps run by pmx, or reporting to prodman on their own (@pm2/io compatible)

原始使用文档
文档目录3 节
  1. Install
  2. Standalone mode
  3. API

@aidra/pmx-io

In-process instrumentation for Node.js and Bun apps that report to prodman: metrics, custom actions, exceptions, events, logs, CPU and heap profiling, and distributed tracing with database and message-broker integrations. It keeps the @pm2/io API, so code written for PM2.io works unchanged.

  • Run by pmx: pmx injects this library into every app it starts; nothing to install. An installed copy stays idle and require returns the injected instance.
  • Run by PM2 / pm2_prodman: reports through the PM2 daemon, like @pm2/io.
  • Standalone (a container's node app.js, an ECS task, a worker): connects to prodman itself as a one-process agent.

Node.js 18 or later, or Bun 1.1 or later. No dependencies.

Install

npm install @aidra/pmx-io

Code that requires @pm2/io can keep doing so: install the package under that name.

npm install @pm2/io@npm:@aidra/pmx-io

Standalone mode

Set the bucket keys (prodman: Bucket settings → Connect servers) and an app name:

PRODMAN_URL=https://prodman.example.com
PM2_PUBLIC_KEY=<public key>
PM2_SECRET_KEY=<secret key>
PM2_APP_NAME=orders-api

Then load the library without changing code:

npx pmx-io-node run -- node server.js
node --require @aidra/pmx-io/standalone server.js
NODE_OPTIONS='--import @aidra/pmx-io/standalone.mjs' node server.mjs

or require it first thing in the app:

const io = require('@aidra/pmx-io')
io.init({ apmOptions: { sendLogs: true, application: 'shop' } })

Settings, server names, containers and troubleshooting: prodman's documentation page Node.js apps without pmx (/docs/node-apm).

API

const io = require('@aidra/pmx-io')

io.metric({ name: 'Queue length' }).set(12)
io.counter({ name: 'Jobs done' }).inc()
io.action('flush cache', (reply) => reply({ ok: true }))
io.notifyError(new Error('payment failed'), { custom: { orderId } })

TypeScript declarations are included (index.d.ts), a superset of @pm2/io's.

Proprietary. © 2026 Mike Warriner.

版本与发布记录

@aidra/pmx-io 共发布 13 个版本,首次发布于 2026/10/29;过去 12 个月发布了 13 个版本。

版本发布日期距今
9.24.0latest2026/11/043 天前
9.23.02026/11/044 天前
9.22.02026/11/016 天前
9.21.02026/11/016 天前
9.20.02026/11/016 天前
9.19.02026/11/017 天前

关于 @aidra/pmx-io 的常见问题

@aidra/pmx-io 是什么?

In-process instrumentation for Node.js and Bun apps run by pmx, or reporting to prodman on their own (@pm2/io compatible)

如何安装 @aidra/pmx-io?

在项目目录运行 npm install @aidra/pmx-io,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 pmx-io-node,可以用 npx pmx-io-node 直接运行。

@aidra/pmx-io 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aidra/pmx-io 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@aidra/pmx-io 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@aidra/pmx-io 可以商用吗?

@aidra/pmx-io 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@aidra/pmx-io 的下载量有多少?

根据 npm 官方下载统计,@aidra/pmx-io 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,118 次,日均约 71 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aidra/pmx-io 还在维护吗?

最新版本 9.24.0 发布于 2026/11/04(3 天前);至今共发布 13 个版本,其中过去 12 个月发布了 13 个;首次发布于 2026/10/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。