2.0.1 • Published 2 years ago
@lamware/powertools-metrics v2.0.1
This Lamware Middleware utilizes the official Lambda TypeScript Powertools provided by AWS to:
- Set-up and memoize a root
Metrics
instance - Publish Metrics automatically after the Function handler executes
- Optionally set-up default dimensions
- Automatically capture various metrics:
- Cold starts
- Function name
Installation
This package is available via NPM:
yarn add @lamware/powertools-metrics
# or
npm install @lamware/powertools-metrics
Usage
import { powertoolsMetrics } from '@lamware/powertools-metrics';
import { MetricUnits } from '@aws-lambda-powertools/metrics';
import type { APIGatewayProxyHandlerV2 } from 'aws-lambda';
import { lamware } from '@lamware/core';
const { handler } = lamware<APIGatewayProxyHandlerV2<any>>()
.use(powertoolsMetrics({
// Options are pass-through to the Tracing instance.
namespace: 'evilkiwi',
serviceName: 'my-api',
}))
.execute(async ({ state }) => {
state.metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
return { statusCode: 200 };
});
export { handler };
1.2.2
2 years ago
2.0.1
2 years ago
2.0.0
2 years ago
1.2.0
3 years ago
1.2.1
3 years ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.25
3 years ago
1.0.24
3 years ago
1.0.23
3 years ago
1.0.22
3 years ago
1.0.21
3 years ago
1.0.20
3 years ago
1.0.19
3 years ago
1.0.18
3 years ago
1.0.17
3 years ago
1.0.16
3 years ago
1.0.15
3 years ago
1.0.14
3 years ago
1.0.13
3 years ago
1.0.12
3 years ago
1.0.11
3 years ago
1.0.10
3 years ago
1.0.9
3 years ago
1.0.8
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago