@dazn/lambda-powertools-pattern-basic

中文文档
1.29.0发布于 2021/05/05MITTypeScriptCommonJS近 30 天下载 4084

Basic template that configures a 1% smaple rate for debug logs

原始使用文档

lambda-powertools-pattern-basic

A basic pattern that helps you follow our guidelines around logging and monitoring.

Main features:

  • configures Datadog metrics namespace using the function name if one is not specified already

  • configures Datadog default tags with awsRegion, functionName, functionVersion and environment

  • applies the @dazn/lambda-powertools-middleware-correlation-ids middleware at a default 1% sample rate

  • applies the @dazn/lambda-powertools-middleware-sample-logging middleware at a default 1% sample rate

  • applies the @dazn/lambda-powertools-middleware-log-timeout middleware at default 10ms threshold (i.e. log an error message 10ms before an invocation actually times out)

  • allow override for the default 1% sample rate via a SAMPLE_DEBUG_LOG_RATE environment variable, to sample debug logs at 5% rate then set SAMPLE_DEBUG_LOG_RATE to 0.05

Getting Started

Install from NPM: npm install @dazn/lambda-powertools-pattern-basic

API

const wrap = require('@dazn/lambda-powertools-pattern-basic')

module.exports.handler = wrap(async (event, context) => {
  return 42
})

版本与发布记录

@dazn/lambda-powertools-pattern-basic 共发布 29 个版本,首次发布于 2019/07/24;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.29.0latest2021/05/055 年前
1.28.12020/12/105 年前
1.28.02020/12/105 年前
1.27.02020/08/136 年前
1.25.02020/07/316 年前
1.24.32020/07/246 年前

关于 @dazn/lambda-powertools-pattern-basic 的常见问题

@dazn/lambda-powertools-pattern-basic 是什么?

Basic template that configures a 1% smaple rate for debug logs

如何安装 @dazn/lambda-powertools-pattern-basic?

在项目目录运行 npm install @dazn/lambda-powertools-pattern-basic,或使用 pnpm add / yarn add / bun add。

@dazn/lambda-powertools-pattern-basic 支持 TypeScript 吗?

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

@dazn/lambda-powertools-pattern-basic 支持 ESM 还是 CommonJS?

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

@dazn/lambda-powertools-pattern-basic 可以商用吗?

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

@dazn/lambda-powertools-pattern-basic 的下载量有多少?

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

@dazn/lambda-powertools-pattern-basic 还在维护吗?

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