Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@middy/cloudwatch-metrics

Package Overview
Dependencies
Maintainers
3
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@middy/cloudwatch-metrics - npm Package Compare versions

Comparing version 3.0.0-alpha.2 to 3.0.0-alpha.3

38

index.js

@@ -1,35 +0,33 @@

import awsEmbeddedMetrics from 'aws-embedded-metrics';
import awsEmbeddedMetrics from 'aws-embedded-metrics'
const defaults = {}
const cloudwatchMetricsMiddleware = (opts = {}) => {
const defaults = {};
const options = { ...defaults,
...opts
};
const options = { ...defaults, ...opts }
const cloudwatchMetricsBefore = request => {
const metrics = awsEmbeddedMetrics.createMetricsLogger();
const cloudwatchMetricsBefore = (request) => {
const metrics = awsEmbeddedMetrics.createMetricsLogger()
// If not set, defaults to aws-embedded-metrics
if (options.namespace) {
metrics.setNamespace(options.namespace);
metrics.setNamespace(options.namespace)
}
// If not set, defaults to ServiceName, ServiceType and LogGroupName
if (options.dimensions) {
metrics.setDimensions(...options.dimensions);
metrics.setDimensions(...options.dimensions)
}
Object.assign(request.context, { metrics })
}
Object.assign(request.context, {
metrics
});
};
const cloudwatchMetricsAfter = async (request) => {
await request.context.metrics.flush()
}
const cloudwatchMetricsAfter = async request => {
await request.context.metrics.flush();
};
return {
before: cloudwatchMetricsBefore,
after: cloudwatchMetricsAfter
};
};
}
}
export default cloudwatchMetricsMiddleware;
export default cloudwatchMetricsMiddleware
{
"name": "@middy/cloudwatch-metrics",
"version": "3.0.0-alpha.2",
"version": "3.0.0-alpha.3",
"description": "Embedded CloudWatch metrics middleware for the middy framework",

@@ -21,3 +21,4 @@ "type": "module",

"test": "npm run test:unit",
"test:unit": "ava"
"test:unit": "ava",
"test:benchmark": "node __benchmarks__/index.js"
},

@@ -57,5 +58,5 @@ "license": "MIT",

"devDependencies": {
"@middy/core": "^3.0.0-alpha.2"
"@middy/core": "^3.0.0-alpha.3"
},
"gitHead": "de30419273ecbff08f367f47c7e320ec981cf145"
"gitHead": "1441158711580313765e6d156046ef0fade0d156"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc