@alwaysmeticulous/backend-recorder-launcher

中文文档
3.6.0发布于 2026/11/06ISCTypeScriptCommonJS构建来源已验证近 30 天下载 19.4万

Downloads the backend-recorder bundle script and executes it

原始使用文档
文档目录6 节
  1. Setup
  2. Option 1: Using instrumentation.js (recommended)
  3. Option 2: Auto-init (zero-code)
  4. Configuration
  5. Redacting recorded backend data
  6. Graceful shutdown

Backend Recorder Launcher

Downloads the backend-recorder bundle script and executes it. The backend recorder intercepts HTTP requests/responses in Node.js apps using OpenTelemetry and exports spans to Meticulous.

Setup

npm install @alwaysmeticulous/backend-recorder-launcher

Create or update your instrumentation.js (or instrumentation.ts) file at the root of your project:

const {
  initBackendRecorder,
} = require("@alwaysmeticulous/backend-recorder-launcher");

initBackendRecorder({
  recordingToken: process.env.METICULOUS_RECORDING_TOKEN,
});

Then start your app with the --require flag so the recorder is loaded before your application code:

node --require ./instrumentation.js app.js

If you are using Next.js, add the instrumentation hook in instrumentation.ts:

export async function register() {
  if (process.env.NEXT_RUNTIME === "nodejs") {
    const { initBackendRecorder } =
      await import("@alwaysmeticulous/backend-recorder-launcher");
    await initBackendRecorder({
      recordingToken: process.env.METICULOUS_RECORDING_TOKEN,
    });
  }
}

Option 2: Auto-init (zero-code)

Use the auto-init entry point which initializes the recorder as a side effect. No code changes needed — just add the --require flag:

node --require @alwaysmeticulous/backend-recorder-launcher/auto-init app.js

The auto-init entry point reads configuration from environment variables.

Configuration

initBackendRecorder accepts an optional BackendRecorderConfig object:

OptionTypeDescription
enabledbooleanEnable/disable the recorder (default: true)
meticulousProjectNamestringThe name of the Meticulous project
recordingTokenstringToken used to authenticate span uploads
exportMode"local" | "s3"Where to export spans (default: "local")
localOutputDirstringDirectory for local exports
flushIntervalMsnumberHow often to flush spans (ms)
spanRedactionHooks((value: string) => string)[]Ordered record-time hooks that transform redactable span strings before upload

Redacting recorded backend data

Use spanRedactionHooks to replace sensitive values before completed spans are saved or uploaded. Each hook receives every redactable string and must return a string. Hooks run in the order they are provided.

await initBackendRecorder({
  recordingToken: process.env.METICULOUS_RECORDING_TOKEN,
  spanRedactionHooks: [
    (value) =>
      value.replace(/api_key=[A-Za-z0-9_-]+/g, "api_key=[REDACTED_API_KEY]"),
  ],
});

The hooks cover span names, error/status messages, and all span attribute values, including strings inside arrays or objects and JSON captured inside strings. They do not transform attribute names, trace/span/parent IDs, timestamps, span kind, client-technology routing, or frontend session IDs.

Hooks run only while recording. If a hook throws or returns a non-string, Meticulous abandons the recording rather than saving the span without redaction. Replacing backend-generated request data can also change a replay match key; use stable replacements and verify that the corresponding input will have the same value during replay. This programmatic option applies to the Node.js recorder and is not available to the Cloudflare Workers sidecar.

Graceful shutdown

initBackendRecorder returns a BackendRecorderHandle with a stopRecording() method. Call it before your process exits to flush any pending spans:

const handle = await initBackendRecorder({
  /* ... */
});

process.on("SIGTERM", async () => {
  await handle?.stopRecording();
  process.exit(0);
});

版本与发布记录

@alwaysmeticulous/backend-recorder-launcher 共发布 90 个版本,首次发布于 2026/05/05;过去 12 个月发布了 90 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.6.0latest2026/11/06今天
3.5.02026/11/051 天前
3.4.12026/10/297 天前
3.2.02026/10/2214 天前
3.1.02026/10/2215 天前
3.0.02026/10/1620 天前

关于 @alwaysmeticulous/backend-recorder-launcher 的常见问题

@alwaysmeticulous/backend-recorder-launcher 是什么?

Downloads the backend-recorder bundle script and executes it

如何安装 @alwaysmeticulous/backend-recorder-launcher?

在项目目录运行 npm install @alwaysmeticulous/backend-recorder-launcher,或使用 pnpm add / yarn add / bun add。

@alwaysmeticulous/backend-recorder-launcher 支持 TypeScript 吗?

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

@alwaysmeticulous/backend-recorder-launcher 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@alwaysmeticulous/backend-recorder-launcher 需要什么版本的 Node.js?

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

@alwaysmeticulous/backend-recorder-launcher 可以商用吗?

@alwaysmeticulous/backend-recorder-launcher 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@alwaysmeticulous/backend-recorder-launcher 的下载量有多少?

根据 npm 官方下载统计,@alwaysmeticulous/backend-recorder-launcher 在 2026/10/06 – 2026/11/04 这 30 天内被下载 194,370 次,日均约 6,479 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@alwaysmeticulous/backend-recorder-launcher 还在维护吗?

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