@opentelemetry/instrumentation-express
Advanced tools
Comparing version 0.40.0 to 0.40.1
@@ -109,3 +109,3 @@ "use strict"; | ||
const layer = this._router.stack[this._router.stack.length - 1]; | ||
instrumentation._applyPatch.call(instrumentation, layer, (0, utils_1.getLayerPath)(args)); | ||
instrumentation._applyPatch(layer, (0, utils_1.getLayerPath)(args)); | ||
return route; | ||
@@ -122,7 +122,7 @@ }; | ||
layer[internal_types_1.kLayerPatched] = true; | ||
this._wrap(layer, 'handle', (original) => { | ||
this._wrap(layer, 'handle', original => { | ||
// TODO: instrument error handlers | ||
if (original.length === 4) | ||
return original; | ||
return function (req, res) { | ||
const patched = function (req, res) { | ||
(0, utils_1.storeLayerPath)(req, layerPath); | ||
@@ -239,2 +239,17 @@ const route = req[internal_types_1._LAYERS_STORE_PROPERTY] | ||
}; | ||
// `handle` isn't just a regular function in some cases. It also contains | ||
// some properties holding metadata and state so we need to proxy them | ||
// through through patched function | ||
// ref: https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1950 | ||
Object.keys(original).forEach(key => { | ||
Object.defineProperty(patched, key, { | ||
get() { | ||
return original[key]; | ||
}, | ||
set(value) { | ||
original[key] = value; | ||
}, | ||
}); | ||
}); | ||
return patched; | ||
}); | ||
@@ -241,0 +256,0 @@ } |
@@ -40,3 +40,3 @@ import type { Request } from 'express'; | ||
export declare type ExpressLayer = { | ||
handle: Function; | ||
handle: Function & Record<string, any>; | ||
[kLayerPatched]?: boolean; | ||
@@ -43,0 +43,0 @@ name: string; |
@@ -1,3 +0,3 @@ | ||
export declare const PACKAGE_VERSION = "0.40.0"; | ||
export declare const PACKAGE_VERSION = "0.40.1"; | ||
export declare const PACKAGE_NAME = "@opentelemetry/instrumentation-express"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,4 +20,4 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.PACKAGE_VERSION = '0.40.0'; | ||
exports.PACKAGE_VERSION = '0.40.1'; | ||
exports.PACKAGE_NAME = '@opentelemetry/instrumentation-express'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-express", | ||
"version": "0.40.0", | ||
"version": "0.40.1", | ||
"description": "OpenTelemetry instrumentation for `express` http web application framework", | ||
@@ -71,3 +71,3 @@ "main": "build/src/index.js", | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-express#readme", | ||
"gitHead": "0af1b70f7c3c9763c85ac51fa5e334c1e1512020" | ||
"gitHead": "93e7aab9a38e22c9ef6c0a9053f817e7e52a687c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
89994
750