@dash0hq/opentelemetry

中文文档
2.0.7发布于 2025/06/25Apache-2.0TypeScriptCommonJS近 30 天下载 2011

Dash0 OpenTelemetry Wrapper for Node.js

此软件包已被标记为弃用

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

原始使用文档
文档目录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. If DASH0_DEBUG_PRINT_SPANS is set to any other non-empty string, the value is interpreted as a file system path. Spans will be appended to that file. The file will be created if it does not exist. If the file cannot be opened for writing, a message will be printed to stderr and no spans will be printed to file. The spans are printed in the same format that the ConsoleSpanExporter uses. This facility is meant for troubleshooting and should not be activated in production.

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.

版本与发布记录

@dash0hq/opentelemetry 共发布 28 个版本,首次发布于 2024/06/25;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.7latest2025/06/251.4 年前
2.0.62025/06/171.4 年前
2.0.52025/06/031.4 年前
2.0.42025/05/271.5 年前
2.0.32025/05/201.5 年前
2.0.22025/05/111.5 年前

关于 @dash0hq/opentelemetry 的常见问题

@dash0hq/opentelemetry 是什么?

Dash0 OpenTelemetry Wrapper for Node.js注意:该包已被作者标记为弃用——Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

如何安装 @dash0hq/opentelemetry?

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

@dash0hq/opentelemetry 支持 TypeScript 吗?

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

@dash0hq/opentelemetry 支持 ESM 还是 CommonJS?

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

@dash0hq/opentelemetry 可以商用吗?

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

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

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

@dash0hq/opentelemetry 还在维护吗?

最新版本 2.0.7 发布于 2025/06/25(1.4 年前);至今共发布 28 个版本,其中过去 12 个月发布了 0 个;首次发布于 2024/06/25。作者已将其标记为弃用,新项目建议寻找替代方案。