@opentelemetry/instrumentation-fastify 0.50.3 → 0.52.0
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.
- package/README.md +1 -1
- package/build/src/utils.js +0 -1
- package/build/src/utils.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/package.json +5 -7
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ npm install --save @opentelemetry/instrumentation-http @opentelemetry/instrument
|
|
|
23
23
|
|
|
24
24
|
### Supported Versions
|
|
25
25
|
|
|
26
|
-
- [`fastify`](https://www.npmjs.com/package/fastify) versions `>=3.0.0 <
|
|
26
|
+
- [`fastify`](https://www.npmjs.com/package/fastify) versions `>=3.0.0 <6`
|
|
27
27
|
|
|
28
28
|
## Usage
|
|
29
29
|
|
package/build/src/utils.js
CHANGED
|
@@ -29,7 +29,6 @@ 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
|
|
33
32
|
Object.defineProperty(reply, constants_1.spanRequestSymbol, {
|
|
34
33
|
enumerable: false,
|
|
35
34
|
configurable: true,
|
package/build/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE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3B;QACD,IAAI,CAAC,GAAG,EAAE,CAAC;IACb,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC,6BAAiB,CAAC,CAAC;AAClC,CAAC;AAjBD,0BAiBC;AAwBD,SAAgB,kCAAkC,CAChD,OAA6B,EAC7B,QAA0C,EAC1C,oBAA8B;IAE9B,IAAI,KAAc,CAAC;IACnB,IAAI,MAAM,GAA+B,SAAS,CAAC;IACnD,IAAI;QACF,MAAM,GAAG,OAAO,EAAE,CAAC;QAEnB,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE;YACrB,MAAM,CAAC,IAAI,CACT,GAAG,CAAC,EAAE,CAAC,QAAQ,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,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,KAAK;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 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"]}
|
package/build/src/version.d.ts
CHANGED
package/build/src/version.js
CHANGED
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.PACKAGE_NAME = exports.PACKAGE_VERSION = void 0;
|
|
19
19
|
// this is autogenerated file, see scripts/version-update.js
|
|
20
|
-
exports.PACKAGE_VERSION = '0.
|
|
20
|
+
exports.PACKAGE_VERSION = '0.52.0';
|
|
21
21
|
exports.PACKAGE_NAME = '@opentelemetry/instrumentation-fastify';
|
|
22
22
|
//# sourceMappingURL=version.js.map
|
package/build/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,YAAY,GAAG,wCAAwC,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 PACKAGE_VERSION = '0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,YAAY,GAAG,wCAAwC,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 PACKAGE_VERSION = '0.52.0';\nexport const PACKAGE_NAME = '@opentelemetry/instrumentation-fastify';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/instrumentation-fastify",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0",
|
|
4
4
|
"description": "OpenTelemetry instrumentation for `fastify` http web application framework",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"types": "build/src/index.d.ts",
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
"clean": "rimraf build/*",
|
|
14
14
|
"compile:with-dependencies": "nx run-many -t compile -p @opentelemetry/instrumentation-fastify",
|
|
15
15
|
"compile": "tsc -p .",
|
|
16
|
-
"lint": "eslint . --ext=ts,js,mjs",
|
|
17
|
-
"lint:fix": "eslint . --ext=ts,js,mjs --fix",
|
|
18
16
|
"lint:readme": "node ../../scripts/lint-readme.js",
|
|
19
17
|
"prepublishOnly": "npm run compile",
|
|
20
18
|
"test": "nyc --no-clean mocha 'test/**/*.test.ts'",
|
|
@@ -50,8 +48,8 @@
|
|
|
50
48
|
"@fastify/express": "^3.0.0",
|
|
51
49
|
"@opentelemetry/api": "^1.3.0",
|
|
52
50
|
"@opentelemetry/context-async-hooks": "^2.0.0",
|
|
53
|
-
"@opentelemetry/contrib-test-utils": "^0.
|
|
54
|
-
"@opentelemetry/instrumentation-http": "^0.
|
|
51
|
+
"@opentelemetry/contrib-test-utils": "^0.54.0",
|
|
52
|
+
"@opentelemetry/instrumentation-http": "^0.207.0",
|
|
55
53
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
56
54
|
"@opentelemetry/sdk-trace-node": "^2.0.0",
|
|
57
55
|
"@types/mocha": "10.0.10",
|
|
@@ -66,9 +64,9 @@
|
|
|
66
64
|
},
|
|
67
65
|
"dependencies": {
|
|
68
66
|
"@opentelemetry/core": "^2.0.0",
|
|
69
|
-
"@opentelemetry/instrumentation": "^0.
|
|
67
|
+
"@opentelemetry/instrumentation": "^0.207.0",
|
|
70
68
|
"@opentelemetry/semantic-conventions": "^1.27.0"
|
|
71
69
|
},
|
|
72
70
|
"homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-fastify#readme",
|
|
73
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "2801ab2f0f9243b154a624298dacb7228c4f70cd"
|
|
74
72
|
}
|