Socket
Socket
Sign inDemoInstall

@iopipe/profiler

Package Overview
Dependencies
Maintainers
8
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iopipe/profiler - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

80

dist/index.js

@@ -17,4 +17,2 @@ 'use strict';

var _core = require('@iopipe/core');
var _simpleGet = require('simple-get');

@@ -73,2 +71,4 @@

this.coreUtil = null;
return this;

@@ -120,39 +120,49 @@ }

getFileUploadMeta() {
// returns a promise here
let { invokedFunctionArn: arn } = this.invocationInstance.context;
var _this = this;
const {
awsRequestId: requestId,
functionName
} = this.invocationInstance.context;
return _asyncToGenerator(function* () {
// patch for potential circular dependency with core
if (!_this.coreUtil) {
const core = yield require('@iopipe/core');
_this.coreUtil = core.util;
}
if (arn === undefined || process.env.AWS_SAM_LOCAL) {
arn = `arn:aws:lambda:local:0:function:${functionName}`;
}
// returns a promise here
let { invokedFunctionArn: arn } = _this.invocationInstance.context;
return _core.util.getFileUploadMeta({
auth: this.token,
networkTimeout: this.config.networkTimeout,
arn,
requestId,
functionName
});
const {
awsRequestId: requestId,
functionName
} = _this.invocationInstance.context;
if (arn === undefined || process.env.AWS_SAM_LOCAL) {
arn = `arn:aws:lambda:local:0:function:${functionName}`;
}
return _this.coreUtil.getFileUploadMeta({
auth: _this.token,
networkTimeout: _this.config.networkTimeout,
arn,
requestId,
functionName
});
})();
}
postInvoke() {
var _this = this;
var _this2 = this;
return _asyncToGenerator(function* () {
if (!_this.enabled) return false;
if (!_this2.enabled) return false;
try {
const [fileUploadMeta = {}] = yield _this.pluginReadyPromise;
const [fileUploadMeta = {}] = yield _this2.pluginReadyPromise;
if (fileUploadMeta.jwtAccess) {
_this.uploads.push(fileUploadMeta.jwtAccess);
_this.signedRequestUrl = fileUploadMeta.signedRequest;
_this2.uploads.push(fileUploadMeta.jwtAccess);
_this2.signedRequestUrl = fileUploadMeta.signedRequest;
} else {
return _this.log(`S3 signer service error. Response: ${JSON.stringify(fileUploadMeta)}`);
return _this2.log(`S3 signer service error. Response: ${JSON.stringify(fileUploadMeta)}`);
}
} catch (err) {
_this.log(err);
_this2.log(err);
// if there is an error setting things up, bail early

@@ -182,3 +192,3 @@ return false;

yield request({
url: _this.signedRequestUrl,
url: _this2.signedRequestUrl,
method: 'PUT',

@@ -192,3 +202,3 @@ body: Buffer.concat(archiveBuffer)

// We will use this number to know when we should finish up all the work
const totalWantedFiles = [_this.profilerEnabled, _this.heapEnabled].filter(Boolean).length;
const totalWantedFiles = [_this2.profilerEnabled, _this2.heapEnabled].filter(Boolean).length;

@@ -199,4 +209,4 @@ let filesSeen = 0;

if (filesSeen === totalWantedFiles) {
if (typeof _this.invocationInstance.context.iopipe.label === 'function') {
_this.invocationInstance.context.iopipe.label('@iopipe/plugin-profiler');
if (typeof _this2.invocationInstance.context.iopipe.label === 'function') {
_this2.invocationInstance.context.iopipe.label('@iopipe/plugin-profiler');
}

@@ -207,4 +217,4 @@ archive.finalize();

if (_this.profilerEnabled) {
_this.sessionPost('Profiler.stop').then(function ({ profile }) {
if (_this2.profilerEnabled) {
_this2.sessionPost('Profiler.stop').then(function ({ profile }) {
archive.append(JSON.stringify(profile), {

@@ -216,8 +226,8 @@ name: 'profile.cpuprofile'

if (_this.heapEnabled) {
_this.session.on('HeapProfiler.addHeapSnapshotChunk', function (obj) {
if (_this2.heapEnabled) {
_this2.session.on('HeapProfiler.addHeapSnapshotChunk', function (obj) {
return heapSnapshotBufferArr.push(obj && obj.params && obj.params.chunk && Buffer.from(obj.params.chunk));
});
_this.sessionPost('HeapProfiler.takeHeapSnapshot').then(function () {
_this2.sessionPost('HeapProfiler.takeHeapSnapshot').then(function () {
archive.append(Buffer.concat(heapSnapshotBufferArr.filter(Boolean)), {

@@ -229,3 +239,3 @@ name: 'profile.heapsnapshot'

} catch (e) {
_this.log(`Error in upload: ${e}`);
_this2.log(`Error in upload: ${e}`);
resolve();

@@ -232,0 +242,0 @@ }

{
"name": "@iopipe/profiler",
"version": "2.1.1",
"version": "2.1.2",
"description": "IOpipe plugin for running the v8 profiler on your functions",

@@ -41,6 +41,6 @@ "main": "dist/index.js",

"nock": "^9.4.1",
"pre-commit": "^1.2.2"
"pre-commit": "^1.2.2",
"@iopipe/core": "^1.19.1"
},
"dependencies": {
"@iopipe/core": "^1.19.1",
"archiver": "^2.1.1",

@@ -47,0 +47,0 @@ "lodash.get": "^4.4.2",

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