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

iopipe

Package Overview
Dependencies
Maintainers
4
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iopipe - npm Package Compare versions

Comparing version 0.8.0 to 1.0.0

17

dist/iopipe.js

@@ -211,2 +211,3 @@ module.exports =

this.startTime = process.hrtime();
this.startTimestamp = Date.now();

@@ -287,3 +288,6 @@ // setup any included plugins

['succeed', 'fail', 'done'].forEach(function (method) {
Object.defineProperty(_this2.originalContext, reset ? method : `original_${method}`, Object.getOwnPropertyDescriptor(_this2.originalContext, reset ? `original_${method}` : method));
var descriptor = Object.getOwnPropertyDescriptor(_this2.originalContext, reset ? `original_${method}` : method);
if (descriptor) {
Object.defineProperty(_this2.originalContext, reset ? method : `original_${method}`, descriptor);
}
delete _this2.originalContext[reset ? `original_${method}` : method];

@@ -579,3 +583,5 @@ });

_wrapperInstance$star = wrapperInstance.startTime,
startTime = _wrapperInstance$star === undefined ? process.hrtime() : _wrapperInstance$star;
startTime = _wrapperInstance$star === undefined ? process.hrtime() : _wrapperInstance$star,
_wrapperInstance$star2 = wrapperInstance.startTimestamp,
startTimestamp = _wrapperInstance$star2 === undefined ? Date.now() : _wrapperInstance$star2;

@@ -604,2 +610,3 @@

processId: _globals2.default.PROCESS_ID,
timestamp: startTimestamp,
aws: {

@@ -819,3 +826,3 @@ functionName,

"name": "iopipe",
"version": "0.8.0",
"version": "1.0.0",
"description": "IOpipe Lambda Analytics & Tracing Agent",

@@ -854,2 +861,5 @@ "main": "dist/iopipe.js",

"homepage": "https://github.com/iopipe/iopipe#readme",
"engines": {
"node": ">=4.3.2"
},
"devDependencies": {

@@ -867,3 +877,2 @@ "aws-lambda-mock-context": "^3.0.0",

"flat": "^2.0.1",
"iopipe-payload": "^1.4.0",
"is-ip": "^2.0.0",

@@ -870,0 +879,0 @@ "istanbul": "^0.4.4",

{
"name": "iopipe",
"version": "0.8.0",
"version": "1.0.0",
"description": "IOpipe Lambda Analytics & Tracing Agent",

@@ -35,2 +35,5 @@ "main": "dist/iopipe.js",

"homepage": "https://github.com/iopipe/iopipe#readme",
"engines": {
"node": ">=4.3.2"
},
"devDependencies": {

@@ -48,3 +51,2 @@ "aws-lambda-mock-context": "^3.0.0",

"flat": "^2.0.1",
"iopipe-payload": "^1.4.0",
"is-ip": "^2.0.0",

@@ -51,0 +53,0 @@ "istanbul": "^0.4.4",

@@ -7,72 +7,68 @@ IOpipe Analytics & Distributed Tracing Agent

This package provides analytics and distributed tracing for
event-driven applications running on AWS Lambda.
This package provides analytics and distributed tracing for event-driven applications running on AWS Lambda.
# Installation & usage
Install by requiring this module, passing it an object with your project token
([register for access](https://www.iopipe.com)), and it will
automatically monitor and collect metrics from your application
running on AWS Lambda.
Install by requiring this module, passing it an object with your project token ([register for access](https://www.iopipe.com)), and it will automatically monitor and collect metrics from your applications running on AWS Lambda.
If you are using the Serverless Framework to deploy your lambdas, check out our
[serverless plugin](https://github.com/iopipe/serverless-plugin-iopipe).
If you are using the Serverless Framework to deploy your lambdas, check out our [serverless plugin](https://github.com/iopipe/serverless-plugin-iopipe).
Example:
```javascript
var iopipe = require("iopipe")({ token: "YOUR_TOKEN"})
```js
const iopipe = require('iopipe')({ token: 'PROJECT_TOKEN' });
exports.handle = iopipe(
function (event, context) {
context.succeed("This is my serverless function!")
}
)
exports.handler = iopipe((event, context) => {
context.succeed('This is my serverless function!');
});
```
# Environment-based config
# Configuration
This library will look for an environment variable, `IOPIPE_TOKEN` and will use
this if one is not explicitly passed to the configuration object. If a project
token is passed to the configuration object, the library will prefer that
token over the environment variable.
#### `token` (string: required)
```javascript
exports.handle = require("iopipe")()(
function (event, context, callback) {
// Do things here. Nothing will be reported.
}
)
If not supplied, the environment variable `$IOPIPE_TOKEN` will be used if present. [Find your project token](https://dashboard.iopipe.com/install)
#### `timeoutWindow` (int: optional = 150)
By default, IOpipe will capture timeouts by exiting your function 150ms early from the AWS configured timeout, to allow time for reporting. You can disable this feature by setting `timeoutWindow` to `0` in your configuration. If not supplied, the environment variable `$IOPIPE_TIMEOUT_WINDOW` will be used if present.
```js
const iopipe = require('iopipe')({ token: 'PROJECT_TOKEN', timeoutWindow: 0})
```
# Capturing timeouts
#### `debug` (bool: optional = false)
By default, IOpipe will capture timeouts by exiting your function 150ms early
from the AWS configured timeout, to allow time for reporting. You can disable this
feature by setting `timeoutWindow` to `0` in your configuration:
Debug mode will log all data sent to IOpipe servers to STDOUT. This is also a good way to evaluate the sort of data that IOpipe is receiving from your application. If not supplied, the environment variable `$IOPIPE_DEBUG` will be used if present.
```javascript
var iopipe = require("iopipe")({ token: "YOUR_TOKEN", timeoutWindow: 0})
```js
const iopipe = require('iopipe')({
token: 'PROJECT_TOKEN',
debug: true
});
exports.handler = iopipe((event, context, callback) => {
// Do things here. We'll log info to STDOUT.
});
```
You can also update the timeout window from `IOPIPE_TIMEOUT_WINDOW` in your environment
variables; IOpipe will prefer the configuration in the code over environment
variables if both are configured.
#### `plugins` (array: optional)
# Debugging integration
Plugins can extend the functionality of IOpipe in ways that best work for you. Just follow the guides for the plugins listed below for proper usage:
Debugging is possible by seeing the `debug` key to `true`
in the configuration as such, which will log all data sent to
IOpipe servers to STDOUT. This is also a good way to evaluate
the sort of data that IOpipe is receiving from your application.
- [Trace Plugin](https://github.com/iopipe/iopipe-plugin-trace)
Debugging is also enabled if the the environment variable,
`IOPIPE_DEBUG` is set to a truthful value.
Example:
```javascript
exports.handle = require("iopipe")({ debug: true })(
function (event, context, callback) {
// Do things here. We'll log info to STDOUT.
}
)
```js
const tracePlugin = require('iopipe-plugin-trace');
const iopipe = require('iopipe')({
token: 'PROJECT_TOKEN',
plugins: [tracePlugin()]
});
exports.handler = iopipe((event, context, callback) => {
// Run your fn here
});
```

@@ -79,0 +75,0 @@

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