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.3 to 3.0.0-alpha.4

38

index.js

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

import awsEmbeddedMetrics from 'aws-embedded-metrics'
import awsEmbeddedMetrics from 'aws-embedded-metrics';
const defaults = {};
const defaults = {}
const cloudwatchMetricsMiddleware = (opts = {}) => {
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 })
}
const cloudwatchMetricsAfter = async (request) => {
await request.context.metrics.flush()
}
Object.assign(request.context, {
metrics
});
};
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.3",
"version": "3.0.0-alpha.4",
"description": "Embedded CloudWatch metrics middleware for the middy framework",

@@ -57,5 +57,5 @@ "type": "module",

"devDependencies": {
"@middy/core": "^3.0.0-alpha.3"
"@middy/core": "^3.0.0-alpha.4"
},
"gitHead": "1441158711580313765e6d156046ef0fade0d156"
"gitHead": "d4bea7f4e21f6a9bbb1f6f6908361169598b9e53"
}
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