Socket
Socket
Sign inDemoInstall

@opentelemetry/instrumentation-aws-lambda

Package Overview
Dependencies
Maintainers
4
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-aws-lambda - npm Package Compare versions

Comparing version 0.16.0 to 0.20.0

build/src/instrumentation.d.ts

3

build/src/index.d.ts

@@ -1,2 +0,3 @@

export * from './aws-lambda';
export * from './instrumentation';
export { AwsLambdaInstrumentationConfig, RequestHook, ResponseHook, } from './types';
//# sourceMappingURL=index.d.ts.map

@@ -25,6 +25,6 @@ "use strict";

var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./aws-lambda"), exports);
__exportStar(require("./instrumentation"), exports);
//# sourceMappingURL=index.js.map

@@ -1,3 +0,17 @@

import { Handler } from 'aws-lambda';
import { Span } from '@opentelemetry/api';
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
import { Handler, Context } from 'aws-lambda';
export declare type LambdaModule = Record<string, Handler>;
export declare type RequestHook = (span: Span, hookInfo: {
event: any;
context: Context;
}) => void;
export declare type ResponseHook = (span: Span, hookInfo: {
err?: Error | string | null;
res?: any;
}) => void;
export interface AwsLambdaInstrumentationConfig extends InstrumentationConfig {
requestHook?: RequestHook;
responseHook?: ResponseHook;
}
//# sourceMappingURL=types.d.ts.map

@@ -1,2 +0,2 @@

export declare const VERSION = "0.16.0";
export declare const VERSION = "0.20.0";
//# sourceMappingURL=version.d.ts.map

@@ -20,3 +20,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.16.0';
exports.VERSION = '0.20.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/instrumentation-aws-lambda",
"version": "0.16.0",
"version": "0.20.0",
"description": "OpenTelemetry AWS Lambda automatic instrumentation package.",

@@ -44,8 +44,8 @@ "main": "build/src/index.js",

"devDependencies": {
"@opentelemetry/node": "0.19.0",
"@types/aws-lambda": "8.10.73",
"@opentelemetry/core": "0.20.0",
"@opentelemetry/node": "0.20.0",
"@types/mocha": "7.0.2",
"@types/node": "14.0.27",
"codecov": "3.7.2",
"gts": "2.0.2",
"@types/node": "14.17.2",
"codecov": "3.8.2",
"gts": "3.1.0",
"mocha": "7.2.0",

@@ -55,14 +55,14 @@ "nyc": "15.1.0",

"ts-mocha": "8.0.0",
"tslint-consistent-codestyle": "1.16.0",
"tslint-microsoft-contrib": "6.2.0",
"typescript": "3.9.7"
"typescript": "4.3.2"
},
"dependencies": {
"@opentelemetry/api": "^1.0.0-rc.0",
"@opentelemetry/instrumentation": "^0.19.0",
"@opentelemetry/resources": "^0.19.0",
"@opentelemetry/semantic-conventions": "^0.19.0",
"@opentelemetry/tracing": "^0.19.0"
"@opentelemetry/api": "^0.20.0",
"@opentelemetry/instrumentation": "^0.20.0",
"@opentelemetry/propagator-aws-xray": "^0.20.0",
"@opentelemetry/resources": "^0.20.0",
"@opentelemetry/semantic-conventions": "^0.20.0",
"@opentelemetry/tracing": "^0.20.0",
"@types/aws-lambda": "8.10.77"
},
"gitHead": "d9365c5d9aa543542a9b48cfe8bc59949101cb02"
"gitHead": "5d73dc2d11a8fd57b21a0c6286861cb992556ca1"
}

@@ -21,2 +21,3 @@ # OpenTelemetry AWS Lambda Instrumentation for Node.js

Create a file to initialize the instrumentation, such as `lambda-wrapper.js`.
```js

@@ -32,5 +33,6 @@ const { NodeTracerProvider } = require('@opentelemetry/node');

instrumentations: [
new AwsLambdaInstrumentation()
new AwsLambdaInstrumentation({
// see under for available configuration
})
],
tracerProvider: provider,
});

@@ -43,2 +45,25 @@ ```

## AWS Lambda Instrumentation Options
| Options | Type | Description |
| --- | --- | --- |
| `requestHook` | `RequestHook` (function) | Hook for adding custom attributes before lambda starts handling the request. Receives params: `span, { event, context }` |
| `responseHook` | `ResponseHook` (function) | Hook for adding custom attributes before lambda returns the response. Receives params: `span, { err?, res? } ` |
### Hooks Usage Example
```js
const { AwsLambdaInstrumentation } = require('@opentelemetry/instrumentation-aws-lambda');
new AwsLambdaInstrumentation({
requestHook: (span, { event, context }) => {
span.setAttributes('faas.name', context.functionName);
},
responseHook: (span, { err, res }) => {
if (err instanceof Error) span.setAttributes('faas.error', err.message);
if (res) span.setAttributes('faas.res', res);
}
})
```
## Useful links

@@ -45,0 +70,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