@opentelemetry/instrumentation-fastify 0.32.1 → 0.32.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,12 +47,14 @@ class FastifyInstrumentation extends instrumentation_1.InstrumentationBase {
47
47
  _hookOnRequest() {
48
48
  const instrumentation = this;
49
49
  return function onRequest(request, reply, done) {
50
+ var _a, _b;
50
51
  if (!instrumentation.isEnabled()) {
51
52
  return done();
52
53
  }
53
54
  instrumentation._wrap(reply, 'send', instrumentation._patchSend());
55
+ const anyRequest = request;
54
56
  const rpcMetadata = (0, core_1.getRPCMetadata)(api_1.context.active());
55
- const routeName = request.routerPath;
57
+ const routeName = ((_b = (_a = anyRequest.routeOptions) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.url) || request.routerPath;
56
58
  if (routeName && (rpcMetadata === null || rpcMetadata === void 0 ? void 0 : rpcMetadata.type) === core_1.RPCType.HTTP) {
57
59
  rpcMetadata.route = routeName;
58
60
  }
@@ -66,7 +68,8 @@ class FastifyInstrumentation extends instrumentation_1.InstrumentationBase {
66
68
  if (!instrumentation.isEnabled()) {
67
69
  return original.apply(this, args);
68
70
  }
69
- const spanName = `${AttributeNames_1.FastifyNames.MIDDLEWARE} - ${original.name || exports.ANONYMOUS_NAME}`;
71
+ const name = original.name || pluginName || exports.ANONYMOUS_NAME;
72
+ const spanName = `${AttributeNames_1.FastifyNames.MIDDLEWARE} - ${name}`;
70
73
  const reply = args[1];
71
74
  const span = (0, utils_1.startSpan)(reply, instrumentation.tracer, spanName, {
72
75
  [AttributeNames_1.AttributeNames.FASTIFY_TYPE]: AttributeNames_1.FastifyTypes.MIDDLEWARE,
@@ -120,11 +123,11 @@ class FastifyInstrumentation extends instrumentation_1.InstrumentationBase {
120
123
  };
121
124
  };
122
125
  }
123
- _patchConstructor(original) {
126
+ _patchConstructor(moduleExports) {
124
127
  const instrumentation = this;
125
128
  this._diag.debug('Patching fastify constructor function');
126
129
  function fastify(...args) {
127
- const app = original.apply(this, args);
130
+ const app = moduleExports.fastify.apply(this, args);
128
131
  app.addHook('onRequest', instrumentation._hookOnRequest());
129
132
  app.addHook('preHandler', instrumentation._hookPreHandler());
130
133
  instrumentation._wrap(app, 'addHook', instrumentation._wrapAddHook());
@@ -158,17 +161,18 @@ class FastifyInstrumentation extends instrumentation_1.InstrumentationBase {
158
161
  const instrumentation = this;
159
162
  this._diag.debug('Patching fastify preHandler function');
160
163
  return function preHandler(request, reply, done) {
161
- var _a;
164
+ var _a, _b, _c, _d;
162
165
  if (!instrumentation.isEnabled()) {
163
166
  return done();
164
167
  }
165
- const requestContext = request.context || {};
166
- const handlerName = (((_a = requestContext.handler) === null || _a === void 0 ? void 0 : _a.name) || '').substr(6);
167
- const spanName = `${AttributeNames_1.FastifyNames.REQUEST_HANDLER} - ${handlerName || exports.ANONYMOUS_NAME}`;
168
+ const anyRequest = request;
169
+ const handler = ((_a = anyRequest.routeOptions) === null || _a === void 0 ? void 0 : _a.handler) || ((_b = anyRequest.context) === null || _b === void 0 ? void 0 : _b.handler) || {};
170
+ const handlerName = handler === null || handler === void 0 ? void 0 : handler.name.substr(6);
171
+ const spanName = `${AttributeNames_1.FastifyNames.REQUEST_HANDLER} - ${handlerName || this.pluginName || exports.ANONYMOUS_NAME}`;
168
172
  const spanAttributes = {
169
173
  [AttributeNames_1.AttributeNames.PLUGIN_NAME]: this.pluginName,
170
174
  [AttributeNames_1.AttributeNames.FASTIFY_TYPE]: AttributeNames_1.FastifyTypes.REQUEST_HANDLER,
171
- [semantic_conventions_1.SemanticAttributes.HTTP_ROUTE]: request.routerPath,
175
+ [semantic_conventions_1.SemanticAttributes.HTTP_ROUTE]: ((_d = (_c = anyRequest.routeOptions) === null || _c === void 0 ? void 0 : _c.config) === null || _d === void 0 ? void 0 : _d.url) || request.routerPath,
172
176
  };
173
177
  if (handlerName) {
174
178
  spanAttributes[AttributeNames_1.AttributeNames.FASTIFY_NAME] = handlerName;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AAM,cAAc,GAAmB;gBACrC,CAAC,+BAAc,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,UAAU;gBAC7C,CAAC,+BAAc,CAAC,YAAY,CAAC,EAAE,6BAAY,CAAC,eAAe;gBAC3D,CAAC,yCAAkB,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU;aACpD,CAAC;YACF,IAAI,WAAW,EAAE;gBACf,cAAc,CAAC,+BAAc,CAAC,YAAY,CAAC,GAAG,WAAW,CAAC;aAC3D;YACD,MAAM,IAAI,GAAG,IAAA,iBAAS,EACpB,KAAK,EACL,eAAe,CAAC,MAAM,EACtB,QAAQ,EACR,cAAc,CACf,CAAC;YAEF,IAAI,eAAe,CAAC,SAAS,EAAE,CAAC,WAAW,EAAE;gBAC3C,IAAA,wCAAsB,EACpB,GAAG,EAAE,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC,WAAY,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,EACjE,CAAC,CAAC,EAAE;oBACF,IAAI,CAAC,EAAE;wBACL,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;qBACvD;gBACH,CAAC,EACD,IAAI,CACL,CAAC;aACH;YAED,OAAO,aAAO,CAAC,IAAI,CAAC,WAAK,CAAC,OAAO,CAAC,aAAO,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE;gBAC9D,IAAI,EAAE,CAAC;YACT,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;CACF;AAvPD,wDAuPC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n context,\n SpanAttributes,\n SpanStatusCode,\n trace,\n} from '@opentelemetry/api';\nimport { getRPCMetadata, RPCType } from '@opentelemetry/core';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport type {\n HookHandlerDoneFunction,\n FastifyInstance,\n FastifyRequest,\n FastifyReply,\n} from 'fastify';\nimport { applicationHookNames } from './constants';\nimport {\n AttributeNames,\n FastifyNames,\n FastifyTypes,\n} from './enums/AttributeNames';\nimport type { HandlerOriginal, PluginFastifyReply } from './internal-types';\nimport type { FastifyInstrumentationConfig } from './types';\nimport {\n endSpan,\n safeExecuteInTheMiddleMaybePromise,\n startSpan,\n} from './utils';\nimport { VERSION } from './version';\n\nexport const ANONYMOUS_NAME = 'anonymous';\n\n/** Fastify instrumentation for OpenTelemetry */\nexport class FastifyInstrumentation extends InstrumentationBase {\n constructor(config: FastifyInstrumentationConfig = {}) {\n super(\n '@opentelemetry/instrumentation-fastify',\n VERSION,\n Object.assign({}, config)\n );\n }\n\n override setConfig(config: FastifyInstrumentationConfig = {}) {\n this._config = Object.assign({}, config);\n }\n\n override getConfig(): FastifyInstrumentationConfig {\n return this._config as FastifyInstrumentationConfig;\n }\n\n init() {\n return [\n new InstrumentationNodeModuleDefinition<any>(\n 'fastify',\n ['^3.0.0', '^4.0.0'],\n (moduleExports, moduleVersion) => {\n this._diag.debug(`Applying patch for fastify@${moduleVersion}`);\n return this._patchConstructor(moduleExports);\n }\n ),\n ];\n }\n\n private _hookOnRequest() {\n const instrumentation = this;\n return function onRequest(\n request: FastifyRequest,\n reply: FastifyReply,\n done: HookHandlerDoneFunction\n ) {\n if (!instrumentation.isEnabled()) {\n return done();\n }\n instrumentation._wrap(reply, 'send', instrumentation._patchSend());\n\n const rpcMetadata = getRPCMetadata(context.active());\n const routeName = request.routerPath;\n if (routeName && rpcMetadata?.type === RPCType.HTTP) {\n rpcMetadata.route = routeName;\n }\n done();\n };\n }\n\n private _wrapHandler(\n pluginName: string,\n hookName: string,\n original: (...args: unknown[]) => Promise<unknown>,\n syncFunctionWithDone: boolean\n ): () => Promise<unknown> {\n const instrumentation = this;\n this._diag.debug('Patching fastify route.handler function');\n\n return function (this: any, ...args: unknown[]): Promise<unknown> {\n if (!instrumentation.isEnabled()) {\n return original.apply(this, args);\n }\n\n const spanName = `${FastifyNames.MIDDLEWARE} - ${\n original.name || ANONYMOUS_NAME\n }`;\n\n const reply = args[1] as PluginFastifyReply;\n\n const span = startSpan(reply, instrumentation.tracer, spanName, {\n [AttributeNames.FASTIFY_TYPE]: FastifyTypes.MIDDLEWARE,\n [AttributeNames.PLUGIN_NAME]: pluginName,\n [AttributeNames.HOOK_NAME]: hookName,\n });\n\n const origDone =\n syncFunctionWithDone &&\n (args[args.length - 1] as HookHandlerDoneFunction);\n if (origDone) {\n args[args.length - 1] = function (\n ...doneArgs: Parameters<HookHandlerDoneFunction>\n ) {\n endSpan(reply);\n origDone.apply(this, doneArgs);\n };\n }\n\n return context.with(trace.setSpan(context.active(), span), () => {\n return safeExecuteInTheMiddleMaybePromise(\n () => {\n return original.apply(this, args);\n },\n err => {\n if (err instanceof Error) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n span.recordException(err);\n }\n // async hooks should end the span as soon as the promise is resolved\n if (!syncFunctionWithDone) {\n endSpan(reply);\n }\n }\n );\n });\n };\n }\n\n private _wrapAddHook(): (\n original: FastifyInstance['addHook']\n ) => () => FastifyInstance {\n const instrumentation = this;\n this._diag.debug('Patching fastify server.addHook function');\n\n return function (\n original: FastifyInstance['addHook']\n ): () => FastifyInstance {\n return function wrappedAddHook(this: any, ...args: any) {\n const name = args[0] as string;\n const handler = args[1] as HandlerOriginal;\n const pluginName = this.pluginName;\n if (applicationHookNames.includes(name)) {\n return original.apply(this, [name as any, handler]);\n }\n\n const syncFunctionWithDone =\n typeof args[args.length - 1] === 'function' &&\n handler.constructor.name !== 'AsyncFunction';\n\n return original.apply(this, [\n name as any,\n instrumentation._wrapHandler(\n pluginName,\n name,\n handler,\n syncFunctionWithDone\n ),\n ]);\n };\n };\n }\n\n private _patchConstructor(\n original: () => FastifyInstance\n ): () => FastifyInstance {\n const instrumentation = this;\n this._diag.debug('Patching fastify constructor function');\n\n function fastify(this: FastifyInstance, ...args: any) {\n const app: FastifyInstance = original.apply(this, args);\n app.addHook('onRequest', instrumentation._hookOnRequest());\n app.addHook('preHandler', instrumentation._hookPreHandler());\n\n instrumentation._wrap(app, 'addHook', instrumentation._wrapAddHook());\n\n return app;\n }\n\n fastify.fastify = fastify;\n fastify.default = fastify;\n return fastify;\n }\n\n private _patchSend() {\n const instrumentation = this;\n this._diag.debug('Patching fastify reply.send function');\n\n return function patchSend(\n original: () => FastifyReply\n ): () => FastifyReply {\n return function send(this: FastifyReply, ...args: any) {\n const maybeError: any = args[0];\n\n if (!instrumentation.isEnabled()) {\n return original.apply(this, args);\n }\n\n return safeExecuteInTheMiddle<FastifyReply>(\n () => {\n return original.apply(this, args);\n },\n err => {\n if (!err && maybeError instanceof Error) {\n err = maybeError;\n }\n endSpan(this, err);\n }\n );\n };\n };\n }\n\n private _hookPreHandler() {\n const instrumentation = this;\n this._diag.debug('Patching fastify preHandler function');\n\n return function preHandler(\n this: any,\n request: FastifyRequest,\n reply: FastifyReply,\n done: HookHandlerDoneFunction\n ) {\n if (!instrumentation.isEnabled()) {\n return done();\n }\n const requestContext = (request as any).context || {};\n const handlerName = (requestContext.handler?.name || '').substr(6);\n const spanName = `${FastifyNames.REQUEST_HANDLER} - ${\n handlerName || ANONYMOUS_NAME\n }`;\n\n const spanAttributes: SpanAttributes = {\n [AttributeNames.PLUGIN_NAME]: this.pluginName,\n [AttributeNames.FASTIFY_TYPE]: FastifyTypes.REQUEST_HANDLER,\n [SemanticAttributes.HTTP_ROUTE]: request.routerPath,\n };\n if (handlerName) {\n spanAttributes[AttributeNames.FASTIFY_NAME] = handlerName;\n }\n const span = startSpan(\n reply,\n instrumentation.tracer,\n spanName,\n spanAttributes\n );\n\n if (instrumentation.getConfig().requestHook) {\n safeExecuteInTheMiddle(\n () => instrumentation.getConfig().requestHook!(span, { request }),\n e => {\n if (e) {\n instrumentation._diag.error('request hook failed', e);\n }\n },\n true\n );\n }\n\n return context.with(trace.setSpan(context.active(), span), () => {\n done();\n });\n };\n }\n}\n"]}
1
+ {"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/instrumentation.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAK4B;AAC5B,8CAA8D;AAC9D,oEAIwC;AACxC,8EAAyE;AAOzE,2CAAmD;AACnD,2DAIgC;AAGhC,mCAIiB;AACjB,uCAAoC;AAEvB,QAAA,cAAc,GAAG,WAAW,CAAC;AAE1C,gDAAgD;AAChD,MAAa,sBAAuB,SAAQ,qCAAmB;IAC7D,YAAY,SAAuC,EAAE;QACnD,KAAK,CACH,wCAAwC,EACxC,iBAAO,EACP,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAC1B,CAAC;IACJ,CAAC;IAEQ,SAAS,CAAC,SAAuC,EAAE;QAC1D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;IAEQ,SAAS;QAChB,OAAO,IAAI,CAAC,OAAuC,CAAC;IACtD,CAAC;IAED,IAAI;QACF,OAAO;YACL,IAAI,qDAAmC,CACrC,SAAS,EACT,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACpB,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE;gBAC/B,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,8BAA8B,aAAa,EAAE,CAAC,CAAC;gBAChE,OAAO,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;YA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,EAAE,CAAC,EACjE,CAAC,CAAC,EAAE;oBACF,IAAI,CAAC,EAAE;wBACL,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;qBACvD;gBACH,CAAC,EACD,IAAI,CACL,CAAC;aACH;YAED,OAAO,aAAO,CAAC,IAAI,CAAC,WAAK,CAAC,OAAO,CAAC,aAAO,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE;gBAC9D,IAAI,EAAE,CAAC;YACT,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;CACF;AA9PD,wDA8PC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n context,\n SpanAttributes,\n SpanStatusCode,\n trace,\n} from '@opentelemetry/api';\nimport { getRPCMetadata, RPCType } from '@opentelemetry/core';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport { SemanticAttributes } from '@opentelemetry/semantic-conventions';\nimport type {\n HookHandlerDoneFunction,\n FastifyInstance,\n FastifyRequest,\n FastifyReply,\n} from 'fastify';\nimport { applicationHookNames } from './constants';\nimport {\n AttributeNames,\n FastifyNames,\n FastifyTypes,\n} from './enums/AttributeNames';\nimport type { HandlerOriginal, PluginFastifyReply } from './internal-types';\nimport type { FastifyInstrumentationConfig } from './types';\nimport {\n endSpan,\n safeExecuteInTheMiddleMaybePromise,\n startSpan,\n} from './utils';\nimport { VERSION } from './version';\n\nexport const ANONYMOUS_NAME = 'anonymous';\n\n/** Fastify instrumentation for OpenTelemetry */\nexport class FastifyInstrumentation extends InstrumentationBase {\n constructor(config: FastifyInstrumentationConfig = {}) {\n super(\n '@opentelemetry/instrumentation-fastify',\n VERSION,\n Object.assign({}, config)\n );\n }\n\n override setConfig(config: FastifyInstrumentationConfig = {}) {\n this._config = Object.assign({}, config);\n }\n\n override getConfig(): FastifyInstrumentationConfig {\n return this._config as FastifyInstrumentationConfig;\n }\n\n init() {\n return [\n new InstrumentationNodeModuleDefinition<any>(\n 'fastify',\n ['^3.0.0', '^4.0.0'],\n (moduleExports, moduleVersion) => {\n this._diag.debug(`Applying patch for fastify@${moduleVersion}`);\n return this._patchConstructor(moduleExports);\n }\n ),\n ];\n }\n\n private _hookOnRequest() {\n const instrumentation = this;\n return function onRequest(\n request: FastifyRequest,\n reply: FastifyReply,\n done: HookHandlerDoneFunction\n ) {\n if (!instrumentation.isEnabled()) {\n return done();\n }\n instrumentation._wrap(reply, 'send', instrumentation._patchSend());\n\n const anyRequest = request as any;\n\n const rpcMetadata = getRPCMetadata(context.active());\n const routeName =\n anyRequest.routeOptions?.config?.url || request.routerPath;\n if (routeName && rpcMetadata?.type === RPCType.HTTP) {\n rpcMetadata.route = routeName;\n }\n done();\n };\n }\n\n private _wrapHandler(\n pluginName: string,\n hookName: string,\n original: (...args: unknown[]) => Promise<unknown>,\n syncFunctionWithDone: boolean\n ): () => Promise<unknown> {\n const instrumentation = this;\n this._diag.debug('Patching fastify route.handler function');\n\n return function (this: any, ...args: unknown[]): Promise<unknown> {\n if (!instrumentation.isEnabled()) {\n return original.apply(this, args);\n }\n\n const name = original.name || pluginName || ANONYMOUS_NAME;\n const spanName = `${FastifyNames.MIDDLEWARE} - ${name}`;\n\n const reply = args[1] as PluginFastifyReply;\n\n const span = startSpan(reply, instrumentation.tracer, spanName, {\n [AttributeNames.FASTIFY_TYPE]: FastifyTypes.MIDDLEWARE,\n [AttributeNames.PLUGIN_NAME]: pluginName,\n [AttributeNames.HOOK_NAME]: hookName,\n });\n\n const origDone =\n syncFunctionWithDone &&\n (args[args.length - 1] as HookHandlerDoneFunction);\n if (origDone) {\n args[args.length - 1] = function (\n ...doneArgs: Parameters<HookHandlerDoneFunction>\n ) {\n endSpan(reply);\n origDone.apply(this, doneArgs);\n };\n }\n\n return context.with(trace.setSpan(context.active(), span), () => {\n return safeExecuteInTheMiddleMaybePromise(\n () => {\n return original.apply(this, args);\n },\n err => {\n if (err instanceof Error) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n span.recordException(err);\n }\n // async hooks should end the span as soon as the promise is resolved\n if (!syncFunctionWithDone) {\n endSpan(reply);\n }\n }\n );\n });\n };\n }\n\n private _wrapAddHook(): (\n original: FastifyInstance['addHook']\n ) => () => FastifyInstance {\n const instrumentation = this;\n this._diag.debug('Patching fastify server.addHook function');\n\n return function (\n original: FastifyInstance['addHook']\n ): () => FastifyInstance {\n return function wrappedAddHook(this: any, ...args: any) {\n const name = args[0] as string;\n const handler = args[1] as HandlerOriginal;\n const pluginName = this.pluginName;\n if (applicationHookNames.includes(name)) {\n return original.apply(this, [name, handler] as never);\n }\n\n const syncFunctionWithDone =\n typeof args[args.length - 1] === 'function' &&\n handler.constructor.name !== 'AsyncFunction';\n\n return original.apply(this, [\n name,\n instrumentation._wrapHandler(\n pluginName,\n name,\n handler,\n syncFunctionWithDone\n ),\n ] as never);\n };\n };\n }\n\n private _patchConstructor(moduleExports: {\n fastify: () => FastifyInstance;\n }): () => FastifyInstance {\n const instrumentation = this;\n this._diag.debug('Patching fastify constructor function');\n\n function fastify(this: FastifyInstance, ...args: any) {\n const app: FastifyInstance = moduleExports.fastify.apply(this, args);\n app.addHook('onRequest', instrumentation._hookOnRequest());\n app.addHook('preHandler', instrumentation._hookPreHandler());\n\n instrumentation._wrap(app, 'addHook', instrumentation._wrapAddHook());\n\n return app;\n }\n\n fastify.fastify = fastify;\n fastify.default = fastify;\n return fastify;\n }\n\n private _patchSend() {\n const instrumentation = this;\n this._diag.debug('Patching fastify reply.send function');\n\n return function patchSend(\n original: () => FastifyReply\n ): () => FastifyReply {\n return function send(this: FastifyReply, ...args: any) {\n const maybeError: any = args[0];\n\n if (!instrumentation.isEnabled()) {\n return original.apply(this, args);\n }\n\n return safeExecuteInTheMiddle<FastifyReply>(\n () => {\n return original.apply(this, args);\n },\n err => {\n if (!err && maybeError instanceof Error) {\n err = maybeError;\n }\n endSpan(this, err);\n }\n );\n };\n };\n }\n\n private _hookPreHandler() {\n const instrumentation = this;\n this._diag.debug('Patching fastify preHandler function');\n\n return function preHandler(\n this: any,\n request: FastifyRequest,\n reply: FastifyReply,\n done: HookHandlerDoneFunction\n ) {\n if (!instrumentation.isEnabled()) {\n return done();\n }\n const anyRequest = request as any;\n\n const handler =\n anyRequest.routeOptions?.handler || anyRequest.context?.handler || {};\n\n const handlerName = handler?.name.substr(6);\n const spanName = `${FastifyNames.REQUEST_HANDLER} - ${\n handlerName || this.pluginName || ANONYMOUS_NAME\n }`;\n\n const spanAttributes: SpanAttributes = {\n [AttributeNames.PLUGIN_NAME]: this.pluginName,\n [AttributeNames.FASTIFY_TYPE]: FastifyTypes.REQUEST_HANDLER,\n [SemanticAttributes.HTTP_ROUTE]:\n anyRequest.routeOptions?.config?.url || request.routerPath,\n };\n if (handlerName) {\n spanAttributes[AttributeNames.FASTIFY_NAME] = handlerName;\n }\n const span = startSpan(\n reply,\n instrumentation.tracer,\n spanName,\n spanAttributes\n );\n\n if (instrumentation.getConfig().requestHook) {\n safeExecuteInTheMiddle(\n () => instrumentation.getConfig().requestHook!(span, { request }),\n e => {\n if (e) {\n instrumentation._diag.error('request hook failed', e);\n }\n },\n true\n );\n }\n\n return context.with(trace.setSpan(context.active(), span), () => {\n done();\n });\n };\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Span, SpanAttributes, Tracer } from '@opentelemetry/api';
1
+ import { Attributes, Span, Tracer } from '@opentelemetry/api';
2
2
  import type { PluginFastifyReply } from './internal-types';
3
3
  /**
4
4
  * Starts Span
@@ -7,7 +7,7 @@ import type { PluginFastifyReply } from './internal-types';
7
7
  * @param spanName - span name
8
8
  * @param spanAttributes - span attributes
9
9
  */
10
- export declare function startSpan(reply: PluginFastifyReply, tracer: Tracer, spanName: string, spanAttributes?: SpanAttributes): Span;
10
+ export declare function startSpan(reply: PluginFastifyReply, tracer: Tracer, spanName: string, spanAttributes?: Attributes): Span;
11
11
  /**
12
12
  * Ends span
13
13
  * @param reply - reply function
@@ -29,6 +29,7 @@ function startSpan(reply, tracer, spanName, spanAttributes = {}) {
29
29
  const span = tracer.startSpan(spanName, { attributes: spanAttributes });
30
30
  const spans = reply[constants_1.spanRequestSymbol] || [];
31
31
  spans.push(span);
32
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
32
33
  Object.defineProperty(reply, constants_1.spanRequestSymbol, {
33
34
  enumerable: false,
34
35
  configurable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAK4B;AAC5B,2CAAgD;AAIhD;;;;;;GAMG;AACH,SAAgB,SAAS,CACvB,KAAyB,EACzB,MAAc,EACd,QAAgB,EAChB,iBAAiC,EAAE;IAEnC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC;IAExE,MAAM,KAAK,GAAW,KAAK,CAAC,6BAAiB,CAAC,IAAI,EAAE,CAAC;IACrD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjB,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,6BAAiB,EAAE;QAC9C,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC;AAlBD,8BAkBC;AAED;;;;GAIG;AACH,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AM,CAAC;KACf;AACH,CAAC;AA7BD,gFA6BC;AAED,SAAS,SAAS,CAAI,GAAmB;;IACvC,OAAO,CACL,CAAC,OAAO,GAAG,KAAK,QAAQ;QACtB,GAAG;QACH,OAAO,CAAA,MAAA,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,0CAAE,KAAK,CAAA;YACxD,UAAU,CAAC;QACf,KAAK,CACN,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Span,\n SpanAttributes,\n SpanStatusCode,\n Tracer,\n} from '@opentelemetry/api';\nimport { spanRequestSymbol } from './constants';\n\nimport type { PluginFastifyReply } from './internal-types';\n\n/**\n * Starts Span\n * @param reply - reply function\n * @param tracer - tracer\n * @param spanName - span name\n * @param spanAttributes - span attributes\n */\nexport function startSpan(\n reply: PluginFastifyReply,\n tracer: Tracer,\n spanName: string,\n spanAttributes: SpanAttributes = {}\n) {\n const span = tracer.startSpan(spanName, { attributes: spanAttributes });\n\n const spans: Span[] = reply[spanRequestSymbol] || [];\n spans.push(span);\n\n Object.defineProperty(reply, spanRequestSymbol, {\n enumerable: false,\n configurable: true,\n value: spans,\n });\n\n return span;\n}\n\n/**\n * Ends span\n * @param reply - reply function\n * @param err - error\n */\nexport function endSpan(reply: PluginFastifyReply, err?: any) {\n const spans = reply[spanRequestSymbol] || [];\n // there is no active span, or it has already ended\n if (!spans.length) {\n return;\n }\n spans.forEach(span => {\n if (err) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n span.recordException(err);\n }\n span.end();\n });\n delete reply[spanRequestSymbol];\n}\n\n// @TODO after approve add this to instrumentation package and replace usage\n// when it will be released\n\n/**\n * This function handles the missing case from instrumentation package when\n * execute can either return a promise or void. And using async is not an\n * option as it is producing unwanted side effects.\n * @param execute - function to be executed\n * @param onFinish - function called when function executed\n * @param preventThrowingError - prevent to throw error when execute\n * function fails\n */\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => Promise<T>,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean\n): Promise<T>;\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => T,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean\n): T;\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => T | Promise<T>,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean\n): T | Promise<T> | undefined {\n let error: unknown;\n let result: T | Promise<T> | undefined = undefined;\n try {\n result = execute();\n\n if (isPromise(result)) {\n result.then(\n res => onFinish(undefined, res),\n err => onFinish(err)\n );\n }\n } catch (e) {\n error = e;\n } finally {\n if (!isPromise(result)) {\n onFinish(error, result);\n if (error && !preventThrowingError) {\n // eslint-disable-next-line no-unsafe-finally\n throw error;\n }\n }\n // eslint-disable-next-line no-unsafe-finally\n return result;\n }\n}\n\nfunction isPromise<T>(val: T | Promise<T>): val is Promise<T> {\n return (\n (typeof val === 'object' &&\n val &&\n typeof Object.getOwnPropertyDescriptor(val, 'then')?.value ===\n 'function') ||\n false\n );\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA8E;AAC9E,2CAAgD;AAIhD;;;;;;GAMG;AACH,SAAgB,SAAS,CACvB,KAAyB,EACzB,MAAc,EACd,QAAgB,EAChB,iBAA6B,EAAE;IAE/B,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,EAA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CAAC,SAAS,EAAE,GAAG,CAAC,EAC/B,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CACrB,CAAC;SACH;KACF;IAAC,OAAO,CAAC,EAAE;QACV,KAAK,GAAG,CAAC,CAAC;KACX;YAAS;QACR,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;YACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YACxB,IAAI,KAAK,IAAI,CAAC,oBAAoB,EAAE;gBAClC,6CAA6C;gBAC7C,MAAM,KAAK,CAAC;aACb;SACF;QACD,6CAA6C;QAC7C,OAAO,MAAM,CAAC;KACf;AACH,CAAC;AA7BD,gFA6BC;AAED,SAAS,SAAS,CAAI,GAAmB;;IACvC,OAAO,CACL,CAAC,OAAO,GAAG,KAAK,QAAQ;QACtB,GAAG;QACH,OAAO,CAAA,MAAA,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,0CAAE,KAAK,CAAA;YACxD,UAAU,CAAC;QACf,KAAK,CACN,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Attributes, Span, SpanStatusCode, Tracer } from '@opentelemetry/api';\nimport { spanRequestSymbol } from './constants';\n\nimport type { PluginFastifyReply } from './internal-types';\n\n/**\n * Starts Span\n * @param reply - reply function\n * @param tracer - tracer\n * @param spanName - span name\n * @param spanAttributes - span attributes\n */\nexport function startSpan(\n reply: PluginFastifyReply,\n tracer: Tracer,\n spanName: string,\n spanAttributes: Attributes = {}\n) {\n const span = tracer.startSpan(spanName, { attributes: spanAttributes });\n\n const spans: Span[] = reply[spanRequestSymbol] || [];\n spans.push(span);\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n Object.defineProperty(reply, spanRequestSymbol, {\n enumerable: false,\n configurable: true,\n value: spans,\n });\n\n return span;\n}\n\n/**\n * Ends span\n * @param reply - reply function\n * @param err - error\n */\nexport function endSpan(reply: PluginFastifyReply, err?: any) {\n const spans = reply[spanRequestSymbol] || [];\n // there is no active span, or it has already ended\n if (!spans.length) {\n return;\n }\n spans.forEach(span => {\n if (err) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message,\n });\n span.recordException(err);\n }\n span.end();\n });\n delete reply[spanRequestSymbol];\n}\n\n// @TODO after approve add this to instrumentation package and replace usage\n// when it will be released\n\n/**\n * This function handles the missing case from instrumentation package when\n * execute can either return a promise or void. And using async is not an\n * option as it is producing unwanted side effects.\n * @param execute - function to be executed\n * @param onFinish - function called when function executed\n * @param preventThrowingError - prevent to throw error when execute\n * function fails\n */\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => Promise<T>,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean\n): Promise<T>;\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => T,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean\n): T;\nexport function safeExecuteInTheMiddleMaybePromise<T>(\n execute: () => T | Promise<T>,\n onFinish: (e: unknown, result?: T) => void,\n preventThrowingError?: boolean\n): T | Promise<T> | undefined {\n let error: unknown;\n let result: T | Promise<T> | undefined = undefined;\n try {\n result = execute();\n\n if (isPromise(result)) {\n result.then(\n res => onFinish(undefined, res),\n err => onFinish(err)\n );\n }\n } catch (e) {\n error = e;\n } finally {\n if (!isPromise(result)) {\n onFinish(error, result);\n if (error && !preventThrowingError) {\n // eslint-disable-next-line no-unsafe-finally\n throw error;\n }\n }\n // eslint-disable-next-line no-unsafe-finally\n return result;\n }\n}\n\nfunction isPromise<T>(val: T | Promise<T>): val is Promise<T> {\n return (\n (typeof val === 'object' &&\n val &&\n typeof Object.getOwnPropertyDescriptor(val, 'then')?.value ===\n 'function') ||\n false\n );\n}\n"]}
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.32.1";
1
+ export declare const VERSION = "0.32.3";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -17,5 +17,5 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.VERSION = void 0;
19
19
  // this is autogenerated file, see scripts/version-update.js
20
- exports.VERSION = '0.32.1';
20
+ exports.VERSION = '0.32.3';
21
21
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.32.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.32.3';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/instrumentation-fastify",
3
- "version": "0.32.1",
3
+ "version": "0.32.3",
4
4
  "description": "OpenTelemetry fastify automatic instrumentation package.",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",
@@ -13,6 +13,7 @@
13
13
  "precompile": "tsc --version && lerna run version:update --scope @opentelemetry/instrumentation-fastify --include-dependencies",
14
14
  "prepare": "npm run compile",
15
15
  "test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts'",
16
+ "test-all-versions": "tav",
16
17
  "version:update": "node ../../../scripts/version-update.js",
17
18
  "prewatch": "npm run precompile",
18
19
  "watch": "tsc -w"
@@ -48,24 +49,25 @@
48
49
  "@fastify/express": "^2.0.2",
49
50
  "@opentelemetry/api": "^1.3.0",
50
51
  "@opentelemetry/context-async-hooks": "^1.8.0",
51
- "@opentelemetry/instrumentation-http": "0.41.2",
52
+ "@opentelemetry/instrumentation-http": "0.44.0",
52
53
  "@opentelemetry/sdk-trace-base": "^1.8.0",
53
54
  "@opentelemetry/sdk-trace-node": "^1.8.0",
54
- "@types/express": "4.17.17",
55
+ "@types/express": "4.17.18",
55
56
  "@types/mocha": "7.0.2",
56
- "@types/node": "18.16.19",
57
+ "@types/node": "18.15.3",
57
58
  "fastify": "4.18.0",
58
59
  "mocha": "7.2.0",
59
60
  "nyc": "15.1.0",
60
- "rimraf": "5.0.1",
61
+ "rimraf": "5.0.5",
62
+ "test-all-versions": "5.0.1",
61
63
  "ts-mocha": "10.0.0",
62
64
  "typescript": "4.4.4"
63
65
  },
64
66
  "dependencies": {
65
67
  "@opentelemetry/core": "^1.8.0",
66
- "@opentelemetry/instrumentation": "^0.41.2",
68
+ "@opentelemetry/instrumentation": "^0.44.0",
67
69
  "@opentelemetry/semantic-conventions": "^1.0.0"
68
70
  },
69
71
  "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-fastify#readme",
70
- "gitHead": "b3d30afe7376760d211b20c4fb45988ac58c1d85"
72
+ "gitHead": "a8c225d2febcac561a70ca586d3efd5a84f9f3fa"
71
73
  }