@opentelemetry/instrumentation-nestjs-core
Advanced tools
Comparing version 0.37.0 to 0.37.1
@@ -26,3 +26,3 @@ "use strict"; | ||
constructor(config = {}) { | ||
super('@opentelemetry/instrumentation-nestjs-core', version_1.VERSION); | ||
super('@opentelemetry/instrumentation-nestjs-core', version_1.VERSION, config); | ||
} | ||
@@ -90,11 +90,11 @@ init() { | ||
const handler = original.apply(this, arguments); | ||
const callbackName = callback.name; | ||
const instanceName = instance.constructor && instance.constructor.name | ||
? instance.constructor.name | ||
: 'UnnamedInstance'; | ||
const spanName = callbackName | ||
? `${instanceName}.${callbackName}` | ||
: instanceName; | ||
return function (req, res, next) { | ||
var _a, _b; | ||
const callbackName = callback.name; | ||
const instanceName = instance.constructor && instance.constructor.name | ||
? instance.constructor.name | ||
: 'UnnamedInstance'; | ||
const spanName = callbackName | ||
? `${instanceName}.${callbackName}` | ||
: instanceName; | ||
const span = tracer.startSpan(spanName, { | ||
@@ -120,6 +120,8 @@ attributes: Object.assign(Object.assign({}, Instrumentation.COMMON_ATTRIBUTES), { [enums_1.AttributeNames.VERSION]: moduleVersion, [enums_1.AttributeNames.TYPE]: enums_1.NestType.REQUEST_CONTEXT, [semantic_conventions_1.SemanticAttributes.HTTP_METHOD]: req.method, [semantic_conventions_1.SemanticAttributes.HTTP_URL]: req.originalUrl || req.url, [semantic_conventions_1.SemanticAttributes.HTTP_ROUTE]: ((_a = req.route) === null || _a === void 0 ? void 0 : _a.path) || ((_b = req.routeOptions) === null || _b === void 0 ? void 0 : _b.url) || req.routerPath, [enums_1.AttributeNames.CONTROLLER]: instanceName, [enums_1.AttributeNames.CALLBACK]: callbackName }), | ||
function createWrapHandler(tracer, moduleVersion, handler) { | ||
const spanName = handler.name || 'anonymous nest handler'; | ||
const options = { | ||
attributes: Object.assign(Object.assign({}, Instrumentation.COMMON_ATTRIBUTES), { [enums_1.AttributeNames.VERSION]: moduleVersion, [enums_1.AttributeNames.TYPE]: enums_1.NestType.REQUEST_HANDLER, [enums_1.AttributeNames.CALLBACK]: handler.name }), | ||
}; | ||
const wrappedHandler = function () { | ||
const span = tracer.startSpan(handler.name || 'anonymous nest handler', { | ||
attributes: Object.assign(Object.assign({}, Instrumentation.COMMON_ATTRIBUTES), { [enums_1.AttributeNames.VERSION]: moduleVersion, [enums_1.AttributeNames.TYPE]: enums_1.NestType.REQUEST_HANDLER, [enums_1.AttributeNames.CALLBACK]: handler.name }), | ||
}); | ||
const span = tracer.startSpan(spanName, options); | ||
const spanContext = api.trace.setSpan(api.context.active(), span); | ||
@@ -126,0 +128,0 @@ return api.context.with(spanContext, async () => { |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.37.0"; | ||
export declare const VERSION = "0.37.1"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.37.0'; | ||
exports.VERSION = '0.37.1'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-nestjs-core", | ||
"version": "0.37.0", | ||
"version": "0.37.1", | ||
"description": "OpenTelemetry NestJS automatic instrumentation package.", | ||
@@ -77,3 +77,3 @@ "main": "build/src/index.js", | ||
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-nestjs-core#readme", | ||
"gitHead": "96a87b48934f0afcf1fe637eed6704f35bd8e973" | ||
"gitHead": "a2e2b5a1aa2910b903829d215184c43d2107b9ac" | ||
} |
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
51309
314