@opentelemetry/instrumentation-express
Advanced tools
Comparing version 0.38.0 to 0.39.0
@@ -31,3 +31,3 @@ "use strict"; | ||
constructor(config = {}) { | ||
super('@opentelemetry/instrumentation-express', version_1.VERSION, Object.assign({}, config)); | ||
super('@opentelemetry/instrumentation-express', version_1.VERSION, config); | ||
} | ||
@@ -82,3 +82,3 @@ setConfig(config = {}) { | ||
const layer = this.stack[this.stack.length - 1]; | ||
instrumentation._applyPatch(layer, typeof args[0] === 'string' ? args[0] : undefined); | ||
instrumentation._applyPatch(layer, (0, utils_1.getLayerPath)(args)); | ||
return route; | ||
@@ -97,3 +97,3 @@ }; | ||
const layer = this.stack[this.stack.length - 1]; | ||
instrumentation._applyPatch(layer, typeof args[0] === 'string' ? args[0] : undefined); | ||
instrumentation._applyPatch(layer, (0, utils_1.getLayerPath)(args)); | ||
return route; | ||
@@ -112,3 +112,3 @@ }; | ||
const layer = this._router.stack[this._router.stack.length - 1]; | ||
instrumentation._applyPatch.call(instrumentation, layer, typeof args[0] === 'string' ? args[0] : undefined); | ||
instrumentation._applyPatch.call(instrumentation, layer, (0, utils_1.getLayerPath)(args)); | ||
return route; | ||
@@ -115,0 +115,0 @@ }; |
import { Span } from '@opentelemetry/api'; | ||
import { InstrumentationConfig } from '@opentelemetry/instrumentation'; | ||
import { ExpressLayerType } from './enums/ExpressLayerType'; | ||
export declare type LayerPathSegment = string | RegExp | number; | ||
export declare type IgnoreMatcher = string | RegExp | ((name: string) => boolean); | ||
@@ -5,0 +6,0 @@ export declare type ExpressRequestInfo<T = any> = { |
import { Attributes } from '@opentelemetry/api'; | ||
import { ExpressInstrumentationConfig } from './types'; | ||
import { ExpressInstrumentationConfig, LayerPathSegment } from './types'; | ||
import { ExpressLayerType } from './enums/ExpressLayerType'; | ||
@@ -36,2 +36,9 @@ import { ExpressLayer, PatchedRequest } from './internal-types'; | ||
export declare const asErrorAndMessage: (error: unknown) => [error: string | Error, message: string]; | ||
/** | ||
* Extracts the layer path from the route arguments | ||
* | ||
* @param args - Arguments of the route | ||
* @returns The layer path | ||
*/ | ||
export declare const getLayerPath: (args: [LayerPathSegment | LayerPathSegment[], ...unknown[]]) => string | undefined; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.asErrorAndMessage = exports.isLayerIgnored = exports.getLayerMetadata = exports.storeLayerPath = void 0; | ||
exports.getLayerPath = exports.asErrorAndMessage = exports.isLayerIgnored = exports.getLayerMetadata = exports.storeLayerPath = void 0; | ||
const ExpressLayerType_1 = require("./enums/ExpressLayerType"); | ||
@@ -134,2 +134,24 @@ const AttributeNames_1 = require("./enums/AttributeNames"); | ||
exports.asErrorAndMessage = asErrorAndMessage; | ||
/** | ||
* Extracts the layer path from the route arguments | ||
* | ||
* @param args - Arguments of the route | ||
* @returns The layer path | ||
*/ | ||
const getLayerPath = (args) => { | ||
if (Array.isArray(args[0])) { | ||
return args[0].map(arg => extractLayerPathSegment(arg) || '').join(','); | ||
} | ||
return extractLayerPathSegment(args[0]); | ||
}; | ||
exports.getLayerPath = getLayerPath; | ||
const extractLayerPathSegment = (arg) => { | ||
if (typeof arg === 'string') { | ||
return arg; | ||
} | ||
if (arg instanceof RegExp || typeof arg === 'number') { | ||
return arg.toString(); | ||
} | ||
return; | ||
}; | ||
//# sourceMappingURL=utils.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.38.0"; | ||
export declare const VERSION = "0.39.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.38.0'; | ||
exports.VERSION = '0.39.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-express", | ||
"version": "0.38.0", | ||
"version": "0.39.0", | ||
"description": "OpenTelemetry express automatic instrumentation package.", | ||
@@ -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": "96a87b48934f0afcf1fe637eed6704f35bd8e973" | ||
"gitHead": "54365a9aafaca6555e13f1276945d6f869d103da" | ||
} |
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
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
88132
733