From c00eb460aa17bafc9bcaba23ceab685e8064247e Mon Sep 17 00:00:00 2001 From: D050513 Date: Mon, 22 Jun 2026 23:17:04 +0200 Subject: [PATCH 1/9] ignore .claude/ --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 9b0ce94b..dc23330c 100644 --- a/.gitignore +++ b/.gitignore @@ -136,3 +136,5 @@ dist test/msg-box test/bookshop/gen test/bookshop/.cdsrc.json + +.claude/ From 9a36e8f024a2dc299f0421e6e0a8a2111332d55f Mon Sep 17 00:00:00 2001 From: D050513 Date: Mon, 22 Jun 2026 23:26:55 +0200 Subject: [PATCH 2/9] oxfmt --- .oxfmtrc.jsonc | 23 +++++++++++++++++++++++ jest.config.js | 4 +++- lib/exporter/ConsoleMetricExporter.js | 4 +++- package.json | 23 +++++++++++++++-------- 4 files changed, 44 insertions(+), 10 deletions(-) create mode 100644 .oxfmtrc.jsonc diff --git a/.oxfmtrc.jsonc b/.oxfmtrc.jsonc new file mode 100644 index 00000000..05f133a2 --- /dev/null +++ b/.oxfmtrc.jsonc @@ -0,0 +1,23 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "arrowParens": "avoid", + "bracketSpacing": true, + "embeddedLanguageFormatting": "auto", + "htmlWhitespaceSensitivity": "css", + "insertPragma": false, + "jsxSingleQuote": false, + "printWidth": 120, + "proseWrap": "preserve", + "quoteProps": "as-needed", + "requirePragma": false, + "semi": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "none", + "useTabs": false, + "vueIndentScriptAndStyle": false, + "sortPackageJson": false, + "ignorePatterns": [ + "*.md" + ] +} \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index 70fb6cd8..c8b71f10 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,7 +8,9 @@ if (process.env.CI && process.env.HANA_DRIVER) { config.testMatch = ['**/tracing-attributes.test.js', '**/passport.test.js'] if (process.env.HANA_PROM) - process.env.cds_requires_telemetry_tracing = JSON.stringify({ _hana_prom: process.env.HANA_PROM === 'true' }) + process.env.cds_requires_telemetry_tracing = JSON.stringify({ +_hana_prom: process.env.HANA_PROM === 'true' + }) } module.exports = config diff --git a/lib/exporter/ConsoleMetricExporter.js b/lib/exporter/ConsoleMetricExporter.js index e04b8cec..833a17a1 100644 --- a/lib/exporter/ConsoleMetricExporter.js +++ b/lib/exporter/ConsoleMetricExporter.js @@ -119,7 +119,9 @@ class ConsoleMetricExporter extends StandardConsoleMetricExporter { // export other metrics for (const tenant of Object.keys(other)) { for (const [k, v] of Object.entries(other[tenant])) { - LOG.info(`${k}${tenant !== 'undefined' ? ` of tenant "${tenant}"` : ''}: ${inspect(v.length === 1 ? v[0] : v)}`) + LOG.info( + `${k}${tenant !== 'undefined' ? ` of tenant "${tenant}"` : ''}: ${inspect(v.length === 1 ? v[0] : v)}` + ) } } } diff --git a/package.json b/package.json index 03583029..370b0131 100644 --- a/package.json +++ b/package.json @@ -2,21 +2,26 @@ "name": "@cap-js/telemetry", "version": "1.6.0", "description": "CDS plugin providing observability features, incl. automatic OpenTelemetry instrumentation.", + "homepage": "https://cap.cloud.sap/", + "license": "Apache-2.0", + "author": "SAP SE (https://www.sap.com)", "repository": { "type": "git", "url": "git+https://github.com/cap-js/telemetry.git" }, - "author": "SAP SE (https://www.sap.com)", - "homepage": "https://cap.cloud.sap/", - "license": "Apache-2.0", - "main": "cds-plugin.js", "files": [ "lib" ], + "main": "cds-plugin.js", "scripts": { "lint": "npx eslint .", + "fmt": "oxfmt", + "fmt:check": "oxfmt --check", "test": "npx jest --silent" }, + "lint-staged": { + "*": "oxfmt --no-error-on-unmatched-pattern" + }, "dependencies": { "@opentelemetry/api": "^1.9", "@opentelemetry/core": "^1.30", @@ -28,9 +33,6 @@ "@opentelemetry/sdk-trace-node": "^1.30", "@opentelemetry/semantic-conventions": "^1.36" }, - "peerDependencies": { - "@sap/cds": "^8 || ^9" - }, "devDependencies": { "@cap-js/cds-test": "^0", "@cap-js/sqlite": "^1 || ^2", @@ -48,7 +50,12 @@ "chai-as-promised": "^7.1.1", "chai-subset": "^1.6.0", "eslint": "^10", - "jest": "^29.7.0" + "jest": "^29.7.0", + "lint-staged": "^17.0.8", + "oxfmt": "^0.56.0" + }, + "peerDependencies": { + "@sap/cds": "^8 || ^9" }, "cds": { "requires": { From 9468fc68eb437deba4b2d57ae126768fe55c6038 Mon Sep 17 00:00:00 2001 From: D050513 Date: Mon, 22 Jun 2026 23:39:42 +0200 Subject: [PATCH 3/9] lint-staged --- jest.config.js | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index c8b71f10..a3b7c85c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,7 +8,7 @@ if (process.env.CI && process.env.HANA_DRIVER) { config.testMatch = ['**/tracing-attributes.test.js', '**/passport.test.js'] if (process.env.HANA_PROM) - process.env.cds_requires_telemetry_tracing = JSON.stringify({ +process.env.cds_requires_telemetry_tracing = JSON.stringify({ _hana_prom: process.env.HANA_PROM === 'true' }) } diff --git a/package.json b/package.json index 370b0131..babf6670 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "main": "cds-plugin.js", "scripts": { "lint": "npx eslint .", + "lint-staged": "lint-staged", "fmt": "oxfmt", "fmt:check": "oxfmt --check", "test": "npx jest --silent" From fce92fd92e8e6ae04bc65615e8b1f61ce373b976 Mon Sep 17 00:00:00 2001 From: D050513 Date: Mon, 22 Jun 2026 23:45:01 +0200 Subject: [PATCH 4/9] husky --- .husky/pre-commit | 1 + jest.config.js | 4 ++-- package.json | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..2312dc58 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/jest.config.js b/jest.config.js index a3b7c85c..e9822f91 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,8 +8,8 @@ if (process.env.CI && process.env.HANA_DRIVER) { config.testMatch = ['**/tracing-attributes.test.js', '**/passport.test.js'] if (process.env.HANA_PROM) -process.env.cds_requires_telemetry_tracing = JSON.stringify({ -_hana_prom: process.env.HANA_PROM === 'true' + process.env.cds_requires_telemetry_tracing = JSON.stringify({ + _hana_prom: process.env.HANA_PROM === 'true' }) } diff --git a/package.json b/package.json index babf6670..3a565f3c 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,10 @@ "main": "cds-plugin.js", "scripts": { "lint": "npx eslint .", - "lint-staged": "lint-staged", "fmt": "oxfmt", "fmt:check": "oxfmt --check", - "test": "npx jest --silent" + "test": "npx jest --silent", + "prepare": "husky" }, "lint-staged": { "*": "oxfmt --no-error-on-unmatched-pattern" @@ -51,6 +51,7 @@ "chai-as-promised": "^7.1.1", "chai-subset": "^1.6.0", "eslint": "^10", + "husky": "^9.1.7", "jest": "^29.7.0", "lint-staged": "^17.0.8", "oxfmt": "^0.56.0" From a162104c476185741a2ad206aa289cfa19dc30d6 Mon Sep 17 00:00:00 2001 From: D050513 Date: Mon, 22 Jun 2026 23:46:09 +0200 Subject: [PATCH 5/9] "prepare": "npx lint-staged" --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3a565f3c..5622c90f 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "fmt": "oxfmt", "fmt:check": "oxfmt --check", "test": "npx jest --silent", - "prepare": "husky" + "prepare": "npx lint-staged" }, "lint-staged": { "*": "oxfmt --no-error-on-unmatched-pattern" From 7eea0c3653ac2edf83a90ef9f641fa6bab73443f Mon Sep 17 00:00:00 2001 From: D050513 Date: Mon, 22 Jun 2026 23:49:18 +0200 Subject: [PATCH 6/9] rm husky --- .husky/pre-commit | 1 - .oxfmtrc.jsonc | 6 ++---- jest.config.js | 2 +- package.json | 14 ++++++-------- 4 files changed, 9 insertions(+), 14 deletions(-) delete mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100644 index 2312dc58..00000000 --- a/.husky/pre-commit +++ /dev/null @@ -1 +0,0 @@ -npx lint-staged diff --git a/.oxfmtrc.jsonc b/.oxfmtrc.jsonc index 05f133a2..587c4a02 100644 --- a/.oxfmtrc.jsonc +++ b/.oxfmtrc.jsonc @@ -17,7 +17,5 @@ "useTabs": false, "vueIndentScriptAndStyle": false, "sortPackageJson": false, - "ignorePatterns": [ - "*.md" - ] -} \ No newline at end of file + "ignorePatterns": ["*.md"] +} diff --git a/jest.config.js b/jest.config.js index e9822f91..c8b71f10 100644 --- a/jest.config.js +++ b/jest.config.js @@ -9,7 +9,7 @@ if (process.env.CI && process.env.HANA_DRIVER) { if (process.env.HANA_PROM) process.env.cds_requires_telemetry_tracing = JSON.stringify({ - _hana_prom: process.env.HANA_PROM === 'true' +_hana_prom: process.env.HANA_PROM === 'true' }) } diff --git a/package.json b/package.json index 5622c90f..309a6b19 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,10 @@ ], "main": "cds-plugin.js", "scripts": { - "lint": "npx eslint .", "fmt": "oxfmt", - "fmt:check": "oxfmt --check", - "test": "npx jest --silent", - "prepare": "npx lint-staged" + "lint": "npx eslint .", + "prepare": "npx lint-staged", + "test": "npx jest --silent" }, "lint-staged": { "*": "oxfmt --no-error-on-unmatched-pattern" @@ -34,6 +33,9 @@ "@opentelemetry/sdk-trace-node": "^1.30", "@opentelemetry/semantic-conventions": "^1.36" }, + "peerDependencies": { + "@sap/cds": "^8 || ^9" + }, "devDependencies": { "@cap-js/cds-test": "^0", "@cap-js/sqlite": "^1 || ^2", @@ -51,14 +53,10 @@ "chai-as-promised": "^7.1.1", "chai-subset": "^1.6.0", "eslint": "^10", - "husky": "^9.1.7", "jest": "^29.7.0", "lint-staged": "^17.0.8", "oxfmt": "^0.56.0" }, - "peerDependencies": { - "@sap/cds": "^8 || ^9" - }, "cds": { "requires": { "telemetry": { From a994959f241d1d7cea66db4f983acc679032aa3e Mon Sep 17 00:00:00 2001 From: D050513 Date: Mon, 22 Jun 2026 23:50:52 +0200 Subject: [PATCH 7/9] reduce diff --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 309a6b19..121f4c7e 100644 --- a/package.json +++ b/package.json @@ -2,17 +2,17 @@ "name": "@cap-js/telemetry", "version": "1.6.0", "description": "CDS plugin providing observability features, incl. automatic OpenTelemetry instrumentation.", - "homepage": "https://cap.cloud.sap/", - "license": "Apache-2.0", - "author": "SAP SE (https://www.sap.com)", "repository": { "type": "git", "url": "git+https://github.com/cap-js/telemetry.git" }, - "files": [ + "author": "SAP SE (https://www.sap.com)", + "homepage": "https://cap.cloud.sap/", + "license": "Apache-2.0", + "main": "cds-plugin.js", + "files": [ "lib" ], - "main": "cds-plugin.js", "scripts": { "fmt": "oxfmt", "lint": "npx eslint .", From 2006a7229e03970f082da35164d383cabac834df Mon Sep 17 00:00:00 2001 From: D050513 Date: Mon, 22 Jun 2026 23:51:42 +0200 Subject: [PATCH 8/9] formatting --- cds-plugin.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cds-plugin.js b/cds-plugin.js index a3b091f2..349dc6e5 100644 --- a/cds-plugin.js +++ b/cds-plugin.js @@ -39,7 +39,7 @@ } if (violations.length) { const msg = - '@cap-js/telemetry does not yet support OpenTelemetry SDK 2.0 (^2 and ^0.200):' + + "@cap-js/telemetry does not yet support OpenTelemetry SDK 2.0 (^2 and ^0.200):" + `\n - ${violations.join('\n - ')}\n` throw new Error(msg) } diff --git a/package.json b/package.json index 121f4c7e..0c4ce170 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "homepage": "https://cap.cloud.sap/", "license": "Apache-2.0", "main": "cds-plugin.js", - "files": [ + "files": [ "lib" ], "scripts": { From de0e96084677abba964b5e4c97972645fed7f6f5 Mon Sep 17 00:00:00 2001 From: D050513 Date: Mon, 22 Jun 2026 23:57:40 +0200 Subject: [PATCH 9/9] re-add husky --- .husky/pre-commit | 1 + cds-plugin.js | 2 +- jest.config.js | 2 +- package.json | 5 +++-- 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..2312dc58 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/cds-plugin.js b/cds-plugin.js index 349dc6e5..a3b091f2 100644 --- a/cds-plugin.js +++ b/cds-plugin.js @@ -39,7 +39,7 @@ } if (violations.length) { const msg = - "@cap-js/telemetry does not yet support OpenTelemetry SDK 2.0 (^2 and ^0.200):" + + '@cap-js/telemetry does not yet support OpenTelemetry SDK 2.0 (^2 and ^0.200):' + `\n - ${violations.join('\n - ')}\n` throw new Error(msg) } diff --git a/jest.config.js b/jest.config.js index c8b71f10..e9822f91 100644 --- a/jest.config.js +++ b/jest.config.js @@ -9,7 +9,7 @@ if (process.env.CI && process.env.HANA_DRIVER) { if (process.env.HANA_PROM) process.env.cds_requires_telemetry_tracing = JSON.stringify({ -_hana_prom: process.env.HANA_PROM === 'true' + _hana_prom: process.env.HANA_PROM === 'true' }) } diff --git a/package.json b/package.json index 0c4ce170..adc4cf5f 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,9 @@ "lib" ], "scripts": { - "fmt": "oxfmt", + "fmt": "npx oxfmt", "lint": "npx eslint .", - "prepare": "npx lint-staged", + "prepare": "husky", "test": "npx jest --silent" }, "lint-staged": { @@ -53,6 +53,7 @@ "chai-as-promised": "^7.1.1", "chai-subset": "^1.6.0", "eslint": "^10", + "husky": "^9.1.7", "jest": "^29.7.0", "lint-staged": "^17.0.8", "oxfmt": "^0.56.0"