@opentelemetry/instrumentation-nestjs-core
Advanced tools
Comparing version
@@ -1,5 +0,3 @@ | ||
import { Instrumentation } from './instrumentation'; | ||
export * from './instrumentation'; | ||
export { Instrumentation as NestInstrumentation }; | ||
export * from './enums/AttributeNames'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -28,7 +28,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NestInstrumentation = void 0; | ||
const instrumentation_1 = require("./instrumentation"); | ||
Object.defineProperty(exports, "NestInstrumentation", { enumerable: true, get: function () { return instrumentation_1.Instrumentation; } }); | ||
__exportStar(require("./instrumentation"), exports); | ||
__exportStar(require("./enums/AttributeNames"), exports); | ||
//# sourceMappingURL=index.js.map |
import { InstrumentationBase, InstrumentationConfig, InstrumentationNodeModuleDefinition, InstrumentationNodeModuleFile } from '@opentelemetry/instrumentation'; | ||
export declare class Instrumentation extends InstrumentationBase { | ||
export declare class NestInstrumentation extends InstrumentationBase { | ||
static readonly COMPONENT = "@nestjs/core"; | ||
@@ -4,0 +4,0 @@ static readonly COMMON_ATTRIBUTES: { |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Instrumentation = void 0; | ||
exports.NestInstrumentation = void 0; | ||
const api = require("@opentelemetry/api"); | ||
@@ -25,3 +25,4 @@ const instrumentation_1 = require("@opentelemetry/instrumentation"); | ||
const enums_1 = require("./enums"); | ||
class Instrumentation extends instrumentation_1.InstrumentationBase { | ||
const supportedVersions = ['>=4.0.0 <11']; | ||
class NestInstrumentation extends instrumentation_1.InstrumentationBase { | ||
constructor(config = {}) { | ||
@@ -31,4 +32,4 @@ super(version_1.PACKAGE_NAME, version_1.PACKAGE_VERSION, config); | ||
init() { | ||
const module = new instrumentation_1.InstrumentationNodeModuleDefinition(Instrumentation.COMPONENT, ['>=4.0.0']); | ||
module.files.push(this.getNestFactoryFileInstrumentation(['>=4.0.0']), this.getRouterExecutionContextFileInstrumentation(['>=4.0.0'])); | ||
const module = new instrumentation_1.InstrumentationNodeModuleDefinition(NestInstrumentation.COMPONENT, supportedVersions); | ||
module.files.push(this.getNestFactoryFileInstrumentation(supportedVersions), this.getRouterExecutionContextFileInstrumentation(supportedVersions)); | ||
return module; | ||
@@ -59,6 +60,6 @@ } | ||
} | ||
exports.Instrumentation = Instrumentation; | ||
Instrumentation.COMPONENT = '@nestjs/core'; | ||
Instrumentation.COMMON_ATTRIBUTES = { | ||
component: Instrumentation.COMPONENT, | ||
exports.NestInstrumentation = NestInstrumentation; | ||
NestInstrumentation.COMPONENT = '@nestjs/core'; | ||
NestInstrumentation.COMMON_ATTRIBUTES = { | ||
component: NestInstrumentation.COMPONENT, | ||
}; | ||
@@ -71,3 +72,3 @@ function createWrapNestFactoryCreate(tracer, moduleVersion) { | ||
const span = tracer.startSpan('Create Nest App', { | ||
attributes: Object.assign(Object.assign({}, Instrumentation.COMMON_ATTRIBUTES), { [enums_1.AttributeNames.TYPE]: enums_1.NestType.APP_CREATION, [enums_1.AttributeNames.VERSION]: moduleVersion, [enums_1.AttributeNames.MODULE]: nestModule.name }), | ||
attributes: Object.assign(Object.assign({}, NestInstrumentation.COMMON_ATTRIBUTES), { [enums_1.AttributeNames.TYPE]: enums_1.NestType.APP_CREATION, [enums_1.AttributeNames.VERSION]: moduleVersion, [enums_1.AttributeNames.MODULE]: nestModule.name }), | ||
}); | ||
@@ -104,3 +105,3 @@ const spanContext = api.trace.setSpan(api.context.active(), span); | ||
const span = tracer.startSpan(spanName, { | ||
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.SEMATTRS_HTTP_METHOD]: req.method, [semantic_conventions_1.SEMATTRS_HTTP_URL]: req.originalUrl || req.url, [semantic_conventions_1.SEMATTRS_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 }), | ||
attributes: Object.assign(Object.assign({}, NestInstrumentation.COMMON_ATTRIBUTES), { [enums_1.AttributeNames.VERSION]: moduleVersion, [enums_1.AttributeNames.TYPE]: enums_1.NestType.REQUEST_CONTEXT, [semantic_conventions_1.SEMATTRS_HTTP_METHOD]: req.method, [semantic_conventions_1.SEMATTRS_HTTP_URL]: req.originalUrl || req.url, [semantic_conventions_1.SEMATTRS_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 }), | ||
}); | ||
@@ -126,3 +127,3 @@ const spanContext = api.trace.setSpan(api.context.active(), span); | ||
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 }), | ||
attributes: Object.assign(Object.assign({}, NestInstrumentation.COMMON_ATTRIBUTES), { [enums_1.AttributeNames.VERSION]: moduleVersion, [enums_1.AttributeNames.TYPE]: enums_1.NestType.REQUEST_HANDLER, [enums_1.AttributeNames.CALLBACK]: handler.name }), | ||
}; | ||
@@ -129,0 +130,0 @@ const wrappedHandler = function () { |
@@ -1,3 +0,3 @@ | ||
export declare const PACKAGE_VERSION = "0.38.0"; | ||
export declare const PACKAGE_VERSION = "0.39.0"; | ||
export declare const PACKAGE_NAME = "@opentelemetry/instrumentation-nestjs-core"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,4 +20,4 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.PACKAGE_VERSION = '0.38.0'; | ||
exports.PACKAGE_VERSION = '0.39.0'; | ||
exports.PACKAGE_NAME = '@opentelemetry/instrumentation-nestjs-core'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-nestjs-core", | ||
"version": "0.38.0", | ||
"version": "0.39.0", | ||
"description": "OpenTelemetry instrumentation for NestJS server side applications framework", | ||
@@ -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": "0af1b70f7c3c9763c85ac51fa5e334c1e1512020" | ||
"gitHead": "ad8436d6a4174f2288cb939080cd4e74da94b0d7" | ||
} |
@@ -20,3 +20,3 @@ # OpenTelemetry NestJS Instrumentation for Node.js | ||
- `>=4.0.0` | ||
- [`@nestjs/core`](https://www.npmjs.com/package/@nestjs/core) versions `>=4.0.0 <11` | ||
@@ -23,0 +23,0 @@ ## Usage |
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
51943
-0.36%312
-1.27%