@dash0/opentelemetry

中文文档
4.2.14发布于 2026/10/05Apache-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 2171

Dash0 OpenTelemetry Wrapper for Node.js

原始使用文档
文档目录11 节
  1. Configuration
  2. DASH0_AUTOMATIC_SERVICE_NAME
  3. DASH0_BOOTSTRAP_SPAN
  4. DASH0_DEBUG
  5. DASH0_DEBUG_PRINT_SPANS
  6. DASH0_DISABLE
  7. DASH0_ENABLE_FS_INSTRUMENTATION
  8. DASH0_FLUSH_ON_SIGTERM_SIGINT
  9. DASH0_FLUSH_ON_EMPTY_EVENT_LOOP
  10. DASH0_OTEL_COLLECTOR_BASE_URL
  11. Enabling only specific instrumentations

Dash0 Node.js OpenTelemetry Distribution

This is the Dash0 OpenTelemetry distribution for Node.js. It is primarily intended to be used by the Dash0 Kubernetes operator to instrument Node.js workloads with OpenTelemetry.

Configuration

DASH0_AUTOMATIC_SERVICE_NAME

If no service name has been set, a service name and a service version are automatically derived by reading the main package.json file (if it is present):

  • The service.name resource attribute will be set to the value of the name attribute found in the package.json file.
  • The service.version resource attribute will be set to the value of the version attribute found in the package.json file.

This behavior can be disabled either

  • by setting an explicit service name using the OTEL_SERVICE_NAME environment variable,
  • by setting an explicit service name using the OTEL_RESOURCE_ATTRIBUTES environment variable (using the service.name attribute key), or
  • by setting the environment variable DASH0_AUTOMATIC_SERVICE_NAME=false.

DASH0_BOOTSTRAP_SPAN

If set to a non-empty string, the distribution will create a span immediately at startup with the span name set to the value of DASH0_BOOTSTRAP_SPAN.

DASH0_DEBUG

Additional debug logs can be enabled by setting DASH0_DEBUG=true.

DASH0_DEBUG_PRINT_SPANS

If DASH0_DEBUG_PRINT_SPANS=true is set, all spans are printed to stdout via the ConsoleSpanExporter.

DASH0_DISABLE

Disables the Dash0 Node.js distribution entirely.

DASH0_ENABLE_FS_INSTRUMENTATION

By default, the instrumentation plug-in @opentelemetry/instrumentation-fs is disabled. Set DASH0_ENABLE_FS_INSTRUMENTATION=true to enable spans for file system access.

DASH0_FLUSH_ON_SIGTERM_SIGINT

If DASH0_FLUSH_ON_SIGTERM_SIGINT=true is set, the Dash0 Node.js distribution will install a handler for SIGTERM and SIGINT that will shutdown the OpenTelemetry SDK gracefully when one of these signals is received. The SDK shutdown is timeboxed to 500 milliseconds. The signal handler will call process.exit(0) after the SDK's shutdown has completed, or after the 500 millisecond timeout, whichever happens sooner. This option can be helpful if you care about telemetry that is being produced shortly before the process terminates. This option must not be used if the application under monitoring has its own handler for SIGTERM or SIGINT, because Dash0's handler (and in particular the necessary process.exit(0) call) might interfere with the application's own signal handler.

DASH0_FLUSH_ON_EMPTY_EVENT_LOOP

By default, the Dash0 Node.js distribution will install a hook that will shutdown the OpenTelemetry SDK gracefully when the Node.js runtime is about to exit because the event loop is empty. This can be disabled by setting DASH0_FLUSH_ON_EMPTY_EVENT_LOOP=false. The SDK shutdown is timeboxed to 500 milliseconds. This hook can be helpful if you care about telemetry that is being produced shortly before the process exits. Disabling it can be useful if you care about the process terminating as quickly as possible when the event loop is empty. In contrast to the handlers for SIGTERM/SIGINT (see above), this hook will not call process.exit (since the Node.js runtime will exit on its own anyway).

DASH0_OTEL_COLLECTOR_BASE_URL

The base URL of the OpenTelemetry collector that the distribution will send data to. It defaults to http://dash0-operator-opentelemetry-collector.dash0-operator-system.svc.cluster.local:4318.

Enabling only specific instrumentations

By default, all supported instrumentations are enabled (with the exception of @opentelemetry/instrumentation-fs), but you can use the environment variable OTEL_NODE_ENABLED_INSTRUMENTATIONS to enable only certain instrumentations by providing a comma-separated list of the instrumentation package names without the @opentelemetry/instrumentation- prefix.

For example, to enable only @opentelemetry/instrumentation-http and @opentelemetry/instrumentation-nestjs-core instrumentations, set OTEL_NODE_ENABLED_INSTRUMENTATIONS="http,nestjs-core".

See https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/metapackages/auto-instrumentations-node/README.md#usage-auto-instrumentation for more information.

版本与发布记录

@dash0/opentelemetry 共发布 30 个版本,首次发布于 2025/07/14;过去 12 个月发布了 22 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
4.2.14latest2026/10/051 个月前
4.2.132026/08/043 个月前
4.2.122026/07/243 个月前
4.2.112026/06/224 个月前
4.2.102026/06/174 个月前
4.2.92026/06/174 个月前

关于 @dash0/opentelemetry 的常见问题

@dash0/opentelemetry 是什么?

Dash0 OpenTelemetry Wrapper for Node.js

如何安装 @dash0/opentelemetry?

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

@dash0/opentelemetry 支持 TypeScript 吗?

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

@dash0/opentelemetry 支持 ESM 还是 CommonJS?

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

@dash0/opentelemetry 可以商用吗?

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

@dash0/opentelemetry 的下载量有多少?

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

@dash0/opentelemetry 还在维护吗?

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