@elastic/opentelemetry-node

中文文档
1.20.1发布于 2026/11/10Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 50万

Elastic Distribution of OpenTelemetry Node.js (EDOT Node.js)

原始使用文档

EDOT Node.js

The Elastic Distribution of OpenTelemetry Node.js (EDOT Node.js) is a lightweight wrapper around the OpenTelemetry SDK for Node.js that makes it easy to get started using OpenTelemetry in your Node.js applications, especially if you are using Elastic Observability as your observability solution.

# Install it
npm install --save @elastic/opentelemetry-node

# Configure it
export OTEL_EXPORTER_OTLP_ENDPOINT="...your-OTLP/collector-endpoint..."
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=..."
export OTEL_SERVICE_NAME="my-app"

# Start it with your application
node --import @elastic/opentelemetry-node my-app.js

See the EDOT Node.js docs for details. Some direct links:

How does EDOT Node.js differ from the OpenTelemetry JS SDK?

EDOT Node.js is very similar to the @opentelemetry/auto-instrumentations-node package from OpenTelemetry in its usage goal: a single-dependency that provides a simple path to zero-code instrumentation of Node.js applications. In general, Elastic's goal is to contribute all SDK improvements upstream. That said, there are sometimes differences that are specific to Elastic (e.g. talking to an Elastic service for central configuration, Elastic-authored additional instrumentations). Here is a concise list of differences:

  • EDOT Node.js supports dynamic central configuration of some settings of the running SDK.
  • EDOT Node.js, being a distribution of the OpenTelemetry JS SDK, always adds the telemetry.distro.* resource attributes to identify itself.
  • EDOT Node.js enables some metrics by default that are not included by @opentelemetry/auto-instrumentations-node: a subset of metrics from @opentelemetry/instrumentation-host-metrics.
  • EDOT Node.js defaults to OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=delta, which differs from the upstream OpenTelemetry JS default of cumulative.
  • EDOT Node.js disables the "log sending" feature of Node.js logging framework instrumentations (for Pino, Bunyan, and Winston) by default. Re-enable this with the ELASTIC_OTEL_NODE_ENABLE_LOG_SENDING=true environment variable. See the ELASTIC_OTEL_NODE_ENABLE_LOG_SENDING documentation for details.
  • EDOT Node.js uses the more recent import-in-the-middle createAddHookMessageChannel feature for improved ESM support. We hope to upstream support for this.
  • Internal diagnostic logging from EDOT Node.js is in a custom JSON-log format, rather than the message-string-only format from OpenTelemetry JS. diag logging in (luggite) JSON format.
  • EDOT Node.js set OTEL_LOG_LEVEL to info by default. This differs from upstream OTel JS (e.g. when using the auto-instrumentations-node package), where OTEL_LOG_LEVEL is not set, which is equivalent to OTEL_LOG_LEVEL=none.

版本与发布记录

@elastic/opentelemetry-node 共发布 31 个版本,首次发布于 2024/05/01;过去 12 个月发布了 15 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.20.1latest2026/11/103 天前
1.20.02026/10/1727 天前
1.19.02026/10/081 个月前
1.18.02026/09/022 个月前
1.17.02026/07/283 个月前
1.16.02026/07/064 个月前

关于 @elastic/opentelemetry-node 的常见问题

@elastic/opentelemetry-node 是什么?

Elastic Distribution of OpenTelemetry Node.js (EDOT Node.js)

如何安装 @elastic/opentelemetry-node?

在项目目录运行 npm install @elastic/opentelemetry-node,或使用 pnpm add / yarn add / bun add。

@elastic/opentelemetry-node 支持 TypeScript 吗?

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

@elastic/opentelemetry-node 支持 ESM 还是 CommonJS?

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

@elastic/opentelemetry-node 需要什么版本的 Node.js?

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

@elastic/opentelemetry-node 可以商用吗?

@elastic/opentelemetry-node 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@elastic/opentelemetry-node 的下载量有多少?

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

@elastic/opentelemetry-node 还在维护吗?

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