@dazn/lambda-powertools-middleware-log-timeout

1.29.0 • Public • Published

lambda-powertools-middleware-log-timeout

A Middy middleware that will log a timeout error message just before the function actually times out.

Main features:

  • records an error log message invocation timed out (with the invocation event as attribute) when an invocation times out

Getting Started

Install from NPM: npm install @dazn/lambda-powertools-middleware-log-timeout

Alternatively, if you use the template @dazn/lambda-powertools-pattern-basic then this would be configured for you.

API

The middleware accepts an optional constructor parameter thresholdMillis, which is the number of millis before an invocation is timed out, that an error message is logged. thresholdMillis defaults to 10ms.

const middy = require('middy')
const logTimeout = require('@dazn/lambda-powertools-middleware-log-timeout')

const handler = async (event, context) => {
  return 42
}

module.exports = middy(handler)
  // or .use(logTimeout(50)) to log the timeout error message 50ms before invocation times out
  .use(logTimeout()) // defaults to 10ms
}

It's recommended that you use the @dazn/lambda-powertools-pattern-basic which configures this middleware along with other useful middlewares.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.29.0934latest

Version History

VersionDownloads (Last 7 Days)Published
1.29.0934
1.28.150
1.28.00
1.24.11
1.24.00
1.23.20
1.23.10
1.23.00
1.22.10
1.22.00
1.21.10
1.21.00
1.15.20
1.9.10
1.9.00
1.8.20
1.8.00

Package Sidebar

Install

npm i @dazn/lambda-powertools-middleware-log-timeout

Weekly Downloads

985

Version

1.29.0

License

MIT

Unpacked Size

13.3 kB

Total Files

6

Last publish

Collaborators

  • gideonparanoid
  • davidrv87
  • gabriela_nowicka
  • dazn.builder.frontend
  • automation-drone
  • m.bazalik
  • dazn.oss.lambda.powertools