@opentelemetry/instrumentation-aws-lambda
Advanced tools
Comparing version 0.25.0 to 0.26.0
@@ -7,3 +7,3 @@ import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation'; | ||
protected _config: AwsLambdaInstrumentationConfig; | ||
private _tracerProvider; | ||
private _forceFlush?; | ||
constructor(_config?: AwsLambdaInstrumentationConfig); | ||
@@ -15,2 +15,3 @@ setConfig(config?: AwsLambdaInstrumentationConfig): void; | ||
setTracerProvider(tracerProvider: TracerProvider): void; | ||
private _getForceFlush; | ||
private _wrapCallback; | ||
@@ -17,0 +18,0 @@ private _endSpan; |
@@ -24,3 +24,2 @@ "use strict"; | ||
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions"); | ||
const tracing_1 = require("@opentelemetry/tracing"); | ||
const version_1 = require("./version"); | ||
@@ -140,4 +139,20 @@ const awsPropagator = new propagator_aws_xray_1.AWSXRayPropagator(); | ||
super.setTracerProvider(tracerProvider); | ||
this._tracerProvider = tracerProvider; | ||
this._forceFlush = this._getForceFlush(tracerProvider); | ||
} | ||
_getForceFlush(tracerProvider) { | ||
if (!tracerProvider) | ||
return undefined; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
let currentProvider = tracerProvider; | ||
if (typeof currentProvider.getDelegate === 'function') { | ||
currentProvider = currentProvider.getDelegate(); | ||
} | ||
if (typeof currentProvider.getActiveSpanProcessor === 'function') { | ||
const activeSpanProcessor = currentProvider.getActiveSpanProcessor(); | ||
if (typeof activeSpanProcessor.forceFlush === 'function') { | ||
return activeSpanProcessor.forceFlush.bind(activeSpanProcessor); | ||
} | ||
} | ||
return undefined; | ||
} | ||
_wrapCallback(original, span) { | ||
@@ -172,9 +187,7 @@ const plugin = this; | ||
span.end(); | ||
if (this._tracerProvider instanceof tracing_1.BasicTracerProvider) { | ||
this._tracerProvider | ||
.getActiveSpanProcessor() | ||
.forceFlush() | ||
.then(() => callback(), () => callback()); | ||
if (this._forceFlush) { | ||
this._forceFlush().then(() => callback(), () => callback()); | ||
} | ||
else { | ||
api_1.diag.error('Spans may not be exported for the lambda function because we are not force flushing before callback.'); | ||
callback(); | ||
@@ -181,0 +194,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.25.0"; | ||
export declare const VERSION = "0.26.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.25.0'; | ||
exports.VERSION = '0.26.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-aws-lambda", | ||
"version": "0.25.0", | ||
"version": "0.26.0", | ||
"description": "OpenTelemetry AWS Lambda automatic instrumentation package.", | ||
@@ -15,3 +15,4 @@ "main": "build/src/index.js", | ||
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../", | ||
"precompile": "tsc --version", | ||
"precompile": "tsc --version && lerna run version --scope $(npm pkg get name) --include-filtered-dependencies", | ||
"prewatch": "npm run precompile", | ||
"prepare": "npm run compile", | ||
@@ -50,4 +51,5 @@ "version:update": "node ../../../scripts/version-update.js", | ||
"@opentelemetry/api": "1.0.2", | ||
"@opentelemetry/core": "0.24.0", | ||
"@opentelemetry/node": "0.24.0", | ||
"@opentelemetry/core": "0.25.0", | ||
"@opentelemetry/sdk-trace-base": "^0.25.0", | ||
"@opentelemetry/sdk-trace-node": "0.25.0", | ||
"@types/mocha": "7.0.2", | ||
@@ -64,10 +66,9 @@ "@types/node": "14.17.9", | ||
"dependencies": { | ||
"@opentelemetry/instrumentation": "^0.24.0", | ||
"@opentelemetry/propagator-aws-xray": "^0.25.0", | ||
"@opentelemetry/resources": "^0.24.0", | ||
"@opentelemetry/instrumentation": "^0.25.0", | ||
"@opentelemetry/propagator-aws-xray": "^0.24.0", | ||
"@opentelemetry/resources": "^0.25.0", | ||
"@opentelemetry/semantic-conventions": "^0.24.0", | ||
"@opentelemetry/tracing": "^0.24.0", | ||
"@types/aws-lambda": "8.10.81" | ||
}, | ||
"gitHead": "fcfaeb965804d2a081f1dc8d2b82803cd51681af" | ||
"gitHead": "8f4a39a8322e3010a0d5d696a9f6582e95f5c544" | ||
} |
@@ -25,3 +25,3 @@ # OpenTelemetry AWS Lambda Instrumentation for Node.js | ||
```js | ||
const { NodeTracerProvider } = require('@opentelemetry/node'); | ||
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node'); | ||
const { AwsLambdaInstrumentation } = require('@opentelemetry/instrumentation-aws-lambda'); | ||
@@ -28,0 +28,0 @@ const { registerInstrumentations } = require('@opentelemetry/instrumentation'); |
Sorry, the diff of this file is not supported yet
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
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
43766
6
16
355
13
+ Added@opentelemetry/api-metrics@0.25.0(transitive)
+ Added@opentelemetry/instrumentation@0.25.0(transitive)
+ Added@opentelemetry/propagator-aws-xray@0.24.0(transitive)
+ Added@opentelemetry/resources@0.25.0(transitive)
- Removed@opentelemetry/tracing@^0.24.0
- Removed@opentelemetry/api-metrics@0.24.0(transitive)
- Removed@opentelemetry/instrumentation@0.24.0(transitive)
- Removed@opentelemetry/propagator-aws-xray@0.25.0(transitive)
- Removed@opentelemetry/resources@0.24.0(transitive)
- Removed@opentelemetry/tracing@0.24.0(transitive)
- Removedlodash.merge@4.6.2(transitive)