UNPKG

@middy/cloudwatch-metrics

Version:

Embedded CloudWatch metrics middleware for the middy framework

20 lines (15 loc) 515 B
import type middy from "@middy/core"; import type { MetricsLogger } from "aws-embedded-metrics"; import type { Context as LambdaContext } from "aws-lambda"; export { MetricsLogger } from "aws-embedded-metrics"; interface Options { namespace?: string; dimensions?: Array<Record<string, string>>; } export type Context = LambdaContext & { metrics: MetricsLogger; }; declare function cloudwatchMetrics( options?: Options, ): middy.MiddlewareObj<unknown, any, Error, Context>; export default cloudwatchMetrics;