@perform/lambda-powertools-middleware-sample-logging

Middy middleware to sample debug logs for a configurable % of invocations

Moved to @dazn/lambda-powertools-middleware-sample-logging - please migrate to the new package by Tuesday 20th August 2019 as this package will be made private.
Last updated a year ago by automation-drone .
MIT · Original npm · Tarball · package.json
$ cnpm install @perform/lambda-powertools-middleware-sample-logging 
SYNC missed versions from official npm registry.

lambda-powertools-middleware-sample-logging

A Middy middleware that will enable debug logging for a configurable % of invocations. Defaults is 1%.

Main features:

  • integrates with the @perform/lambda-powertools-logger package to enable debug logging

  • integrates with the @perform/lambda-powertools-correlation-ids package to allow sampling decision to flow through correlation IDs - i.e. enable debug logging at the edge, and the entire call chain will respect that decision

  • enables debug logging for some % (defaults to 1%) of invocations

  • records an error log message with the invocation event as attribute when an invocation errors

Getting Started

Install from NPM: npm install @perform/lambda-powertools-middleware-sample-logging

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

API

Accepts a configuration object of the following shape:

{
  sampleRate: double [between 0 and 1]
}
const middy = require('middy')
const sampleLogging = require('@perform/lambda-powertools-middleware-sample-logging')

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

module.exports = middy(handler)
  .use(sampleLogging({ sampleRate: 0.01 }))
}

This middleware is often used alongside the @perform/lambda-powertools-middleware-correlation-ids middleware to implement sample logging. It's recommended that you use the @perform/lambda-powertools-pattern-basic which configures both to enable debug logging at 1% of invocations.

Current Tags

  • 1.8.0                                ...           latest (a year ago)

27 Versions

  • 1.8.0 [deprecated]           ...           a year ago
  • 1.5.0 [deprecated]           ...           a year ago
  • 1.3.0 [deprecated]           ...           a year ago
  • 1.1.7 [deprecated]           ...           2 years ago
  • 1.0.1 [deprecated]           ...           2 years ago
  • 1.0.0 [deprecated]           ...           2 years ago
  • 0.10.5 [deprecated]           ...           2 years ago
  • 0.10.4 [deprecated]           ...           2 years ago
  • 0.10.3 [deprecated]           ...           2 years ago
  • 0.10.2 [deprecated]           ...           2 years ago
  • 0.10.1 [deprecated]           ...           2 years ago
  • 0.10.0 [deprecated]           ...           2 years ago
  • 0.9.0 [deprecated]           ...           2 years ago
  • 0.8.0 [deprecated]           ...           2 years ago
  • 0.7.0 [deprecated]           ...           2 years ago
  • 0.6.4 [deprecated]           ...           2 years ago
  • 0.6.3 [deprecated]           ...           2 years ago
  • 0.6.2 [deprecated]           ...           2 years ago
  • 0.6.0 [deprecated]           ...           2 years ago
  • 0.5.0 [deprecated]           ...           2 years ago
  • 0.4.0 [deprecated]           ...           2 years ago
  • 0.3.0 [deprecated]           ...           2 years ago
  • 0.2.12 [deprecated]           ...           2 years ago
  • 0.2.11 [deprecated]           ...           2 years ago
  • 0.2.10 [deprecated]           ...           2 years ago
  • 0.2.9 [deprecated]           ...           2 years ago
  • 0.2.8 [deprecated]           ...           2 years ago
Maintainers (325)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |