@opentelemetry/instrumentation-aws-lambda
Advanced tools
Comparing version 0.16.0 to 0.20.0
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32017
11
327
85
7
4
1
+ Added@types/aws-lambda@8.10.77
+ Added@opentelemetry/api@0.20.0(transitive)
+ Added@opentelemetry/api-metrics@0.20.0(transitive)
+ Added@opentelemetry/core@0.20.0(transitive)
+ Added@opentelemetry/instrumentation@0.20.0(transitive)
+ Added@opentelemetry/propagator-aws-xray@0.20.0(transitive)
+ Added@opentelemetry/resources@0.20.0(transitive)
+ Added@opentelemetry/semantic-conventions@0.20.0(transitive)
+ Added@opentelemetry/tracing@0.20.0(transitive)
+ Added@types/aws-lambda@8.10.77(transitive)
- Removed@opentelemetry/api@1.9.0(transitive)
- Removed@opentelemetry/api-metrics@0.19.0(transitive)
- Removed@opentelemetry/core@0.19.0(transitive)
- Removed@opentelemetry/instrumentation@0.19.0(transitive)
- Removed@opentelemetry/resources@0.19.0(transitive)
- Removed@opentelemetry/semantic-conventions@0.19.0(transitive)
- Removed@opentelemetry/tracing@0.19.0(transitive)
Updated@opentelemetry/api@^0.20.0