@opentelemetry/instrumentation-connect
Advanced tools
Comparing version 0.32.0 to 0.32.1
@@ -17,6 +17,15 @@ "use strict"; | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
(0, tslib_1.__exportStar)(require("./enums/AttributeNames"), exports); | ||
(0, tslib_1.__exportStar)(require("./instrumentation"), exports); | ||
__exportStar(require("./enums/AttributeNames"), exports); | ||
__exportStar(require("./instrumentation"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -16,3 +16,5 @@ import { Span } from '@opentelemetry/api'; | ||
_patchUse(original: Server['use']): Use; | ||
_patchHandle(original: Server['handle']): Server['handle']; | ||
_patchOut(out: NextFunction, completeStack: () => void): NextFunction; | ||
} | ||
//# sourceMappingURL=instrumentation.d.ts.map |
@@ -25,2 +25,3 @@ "use strict"; | ||
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions"); | ||
const utils_1 = require("./utils"); | ||
exports.ANONYMOUS_NAME = 'anonymous'; | ||
@@ -46,2 +47,5 @@ /** Connect instrumentation for OpenTelemetry */ | ||
} | ||
if (!(0, instrumentation_1.isWrapped)(patchedApp.handle)) { | ||
this._wrap(patchedApp, 'handle', this._patchHandle.bind(this)); | ||
} | ||
} | ||
@@ -94,8 +98,12 @@ _patchConstructor(original) { | ||
} | ||
const [resArgIdx, nextArgIdx] = isErrorMiddleware ? [2, 3] : [1, 2]; | ||
const [reqArgIdx, resArgIdx, nextArgIdx] = isErrorMiddleware | ||
? [1, 2, 3] | ||
: [0, 1, 2]; | ||
const req = arguments[reqArgIdx]; | ||
const res = arguments[resArgIdx]; | ||
const next = arguments[nextArgIdx]; | ||
(0, utils_1.replaceCurrentStackRoute)(req, routeName); | ||
const rpcMetadata = (0, core_1.getRPCMetadata)(api_1.context.active()); | ||
if (routeName && (rpcMetadata === null || rpcMetadata === void 0 ? void 0 : rpcMetadata.type) === core_1.RPCType.HTTP) { | ||
rpcMetadata.route = routeName; | ||
rpcMetadata.route = (0, utils_1.generateRoute)(req); | ||
} | ||
@@ -143,4 +151,23 @@ let spanName = ''; | ||
} | ||
_patchHandle(original) { | ||
const instrumentation = this; | ||
return function () { | ||
const [reqIdx, outIdx] = [0, 2]; | ||
const req = arguments[reqIdx]; | ||
const out = arguments[outIdx]; | ||
const completeStack = (0, utils_1.addNewStackLayer)(req); | ||
if (typeof out === 'function') { | ||
arguments[outIdx] = instrumentation._patchOut(out, completeStack); | ||
} | ||
return original.apply(this, arguments); | ||
}; | ||
} | ||
_patchOut(out, completeStack) { | ||
return function nextFunction(...args) { | ||
completeStack(); | ||
return Reflect.apply(out, this, args); | ||
}; | ||
} | ||
} | ||
exports.ConnectInstrumentation = ConnectInstrumentation; | ||
//# sourceMappingURL=instrumentation.js.map |
@@ -1,2 +0,3 @@ | ||
import type { HandleFunction, Server } from 'connect'; | ||
import type { HandleFunction, IncomingMessage, Server } from 'connect'; | ||
export declare const _LAYERS_STORE_PROPERTY: unique symbol; | ||
export declare type UseArgs1 = [HandleFunction]; | ||
@@ -6,2 +7,5 @@ export declare type UseArgs2 = [string, HandleFunction]; | ||
export declare type Use = (...args: UseArgs) => Server; | ||
export declare type PatchedRequest = { | ||
[_LAYERS_STORE_PROPERTY]: string[]; | ||
} & IncomingMessage; | ||
//# sourceMappingURL=internal-types.d.ts.map |
@@ -18,2 +18,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports._LAYERS_STORE_PROPERTY = void 0; | ||
exports._LAYERS_STORE_PROPERTY = Symbol('opentelemetry.instrumentation-connect.request-route-stack'); | ||
//# sourceMappingURL=internal-types.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.32.0"; | ||
export declare const VERSION = "0.32.1"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.32.0'; | ||
exports.VERSION = '0.32.1'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-connect", | ||
"version": "0.32.0", | ||
"version": "0.32.1", | ||
"description": "OpenTelemetry connect automatic instrumentation package.", | ||
@@ -52,7 +52,7 @@ "main": "build/src/index.js", | ||
"@types/mocha": "7.0.2", | ||
"@types/node": "18.11.7", | ||
"@types/node": "18.16.19", | ||
"connect": "3.7.0", | ||
"mocha": "7.2.0", | ||
"nyc": "15.1.0", | ||
"rimraf": "5.0.0", | ||
"rimraf": "5.0.1", | ||
"ts-mocha": "10.0.0", | ||
@@ -63,9 +63,8 @@ "typescript": "4.4.4" | ||
"@opentelemetry/core": "^1.8.0", | ||
"@opentelemetry/instrumentation": "^0.41.0", | ||
"@opentelemetry/instrumentation": "^0.41.2", | ||
"@opentelemetry/semantic-conventions": "^1.0.0", | ||
"@types/connect": "3.4.35", | ||
"tslib": "^2.3.1" | ||
"@types/connect": "3.4.35" | ||
}, | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-connect#readme", | ||
"gitHead": "f81f8a76a8f0af2101c62dbc73cde442f875d833" | ||
"gitHead": "b3d30afe7376760d211b20c4fb45988ac58c1d85" | ||
} |
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
33240
5
15
367
- Removedtslib@^2.3.1
- Removedtslib@2.8.1(transitive)