@dash0/serverless-dash0

中文文档
1.0.9发布于 2026/11/09Apache-2.0TypeScriptCommonJS零依赖构建来源已验证近 30 天下载 25.5万

Serverless Framework plugin to automatically add Dash0 Lambda tracing layers and configuration

原始使用文档
文档目录7 节
  1. Installation
  2. Usage
  3. Supported runtimes
  4. Configuration reference
  5. Required
  6. Optional
  7. Behavior

serverless-dash0

Serverless Framework plugin that automatically adds the Dash0 Lambda extension layer and environment variables to your functions.

Compatible with Serverless Framework v3 and v4.

Installation

npm install --save-dev @dash0/serverless-dash0

Usage

Add the plugin to your serverless.yml and configure the custom.dash0 section:

Where to find your endpoint: In the Dash0 app, go to Settings → Endpoints → OTLP via HTTP and copy the value from the Endpoint field.

plugins:
  - "@dash0/serverless-dash0"

custom:
  dash0:
    endpoint: https://ingress.<your-environment>.dash0.com:4318  # e.g. https://ingress.eu-west-1.aws.dash0.com:4318
    token: ${env:DASH0_TOKEN}
    layerVersion: latest

functions:
  myFunction:
    handler: handler.hello
    runtime: nodejs20.x
    dash0-traced: true

  untracedFunction:
    handler: handler.other
    runtime: nodejs20.x

Only functions with dash0-traced: true will have the Dash0 layer and environment variables added. All other functions are left untouched.

Supported runtimes

RuntimeLayer
nodejs*dash0-extension-node
python*dash0-extension-python
java*dash0-extension-java

Container image functions (image instead of handler) are not supported. Use the Dash0 Docker images instead.

Configuration reference

All options are set under custom.dash0 in your serverless.yml.

Required

OptionTypeDescription
endpointstringDash0 OTLP ingestion endpoint. Find it in the Dash0 app under Settings → Endpoints → OTLP via HTTP → Endpoint.
layerVersionnumber or "latest"Layer version to use. A specific version number, or "latest" to use the version bundled with the plugin.
tokenstringDash0 API token. Required unless tokenSecretArn is provided.
tokenSecretArnstringARN of an AWS Secrets Manager secret containing the Dash0 API token. Required unless token is provided. If both are set, both environment variables will be added.

Optional

OptionTypeDefaultEnv var setDescription
tokenSecretKeystring-DASH0_TOKEN_SECRET_KEYJSON key to extract the token from the secret (when the secret value is a JSON object).
datasetstring-DASH0_DATASETRoute telemetry to a specific Dash0 dataset.
extensionLogLevelstringwarnDASH0_EXTENSION_LOG_LEVELLog level for the extension. One of: trace, debug, info, warn, error.
disableAutoInstrumentationbooleanfalseDASH0_DISABLE_AUTO_INSTRUMENTATIONDisable auto-instrumentation. The extension will still create synthetic spans.
sendOnInvocationEndbooleantrueDASH0_SEND_ON_INVOCATION_ENDSend telemetry at the end of the current invocation instead of the beginning of the next.
disableTelemetryLogCollectionbooleanfalseDASH0_DISABLE_TELEMETRY_LOG_COLLECTIONDisable Lambda Telemetry API log collection.
disableTelemetryMetricsbooleanfalseDASH0_DISABLE_TELEMETRY_METRICSDisable emission of supplementary FaaS metrics.
disableTelemetryTracesbooleanfalseDASH0_DISABLE_TELEMETRY_TRACESDisable both auto-instrumentation and synthetic spans (including error-path traces).
createPayloadLogRecordsbooleantrueDASH0_CREATE_PAYLOAD_LOG_RECORDSCreate log records for request/response payloads.
requestTimeoutnumber2000DASH0_REQUEST_TIMEOUTHTTP request timeout in milliseconds.
xrayTracesEnabledbooleanfalseDASH0_XRAY_TRACES_ENABLEDPreserve X-Ray trace context.
maskRulesstring-DASH0_MASK_RULESJSON array of regex patterns for masking sensitive data.
maskEnvVarsstring-DASH0_MASK_ENV_VARSJSON array of regex patterns for masking environment variable values.

Behavior

  • The plugin runs at the before:package:initialize lifecycle hook.
  • Existing function layers are preserved; the Dash0 layer is appended.
  • Existing function environment variables are never overwritten. If you set DASH0_EXTENSION_LOG_LEVEL on a specific function, the plugin will not replace it with the global value.
  • Functions with unsupported runtimes or container images are skipped with a warning.

版本与发布记录

@dash0/serverless-dash0 共发布 10 个版本,首次发布于 2026/04/27;过去 12 个月发布了 10 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.9latest2026/11/092 天前
1.0.82026/11/047 天前
1.0.72026/10/3011 天前
1.0.62026/10/2022 天前
1.0.52026/09/171 个月前
1.0.42026/09/112 个月前

关于 @dash0/serverless-dash0 的常见问题

@dash0/serverless-dash0 是什么?

Serverless Framework plugin to automatically add Dash0 Lambda tracing layers and configuration

如何安装 @dash0/serverless-dash0?

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

@dash0/serverless-dash0 支持 TypeScript 吗?

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

@dash0/serverless-dash0 支持 ESM 还是 CommonJS?

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

@dash0/serverless-dash0 需要什么版本的 Node.js?

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

@dash0/serverless-dash0 可以商用吗?

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

@dash0/serverless-dash0 的下载量有多少?

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

@dash0/serverless-dash0 还在维护吗?

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