diff --git a/package-lock.json b/package-lock.json index 4ddfd9f..9aaf355 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@types/supertest": "^6.0.2", "chalk": "^4.1.2", "chokidar": "^3.6.0", - "prom-client": "^14.2.0", + "prom-client": "^15.1.2", "response-time": "^2.3.2", "rollup": "^4.14.3", "undici": "^5.27.2", @@ -2684,6 +2684,14 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==", + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@polka/url": { "version": "1.0.0-next.23", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.23.tgz", @@ -7821,14 +7829,15 @@ "dev": true }, "node_modules/prom-client": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-14.2.0.tgz", - "integrity": "sha512-sF308EhTenb/pDRPakm+WgiN+VdM/T1RaHj1x+MvAuT8UiQP8JmOEbxVqtkbfR4LrvOg5n7ic01kRBDGXjYikA==", + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", "dependencies": { + "@opentelemetry/api": "^1.4.0", "tdigest": "^0.1.1" }, "engines": { - "node": ">=10" + "node": "^16 || ^18 || >=20" } }, "node_modules/proxy-addr": { @@ -11429,6 +11438,11 @@ } } }, + "@opentelemetry/api": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.8.0.tgz", + "integrity": "sha512-I/s6F7yKUDdtMsoBWXJe8Qz40Tui5vsuKCWJEWVL+5q9sSWRzzx6v2KeNsOBEwd94j0eWkpWCH4yB6rZg9Mf0w==" + }, "@polka/url": { "version": "1.0.0-next.23", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.23.tgz", @@ -15114,10 +15128,11 @@ "dev": true }, "prom-client": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-14.2.0.tgz", - "integrity": "sha512-sF308EhTenb/pDRPakm+WgiN+VdM/T1RaHj1x+MvAuT8UiQP8JmOEbxVqtkbfR4LrvOg5n7ic01kRBDGXjYikA==", + "version": "15.1.2", + "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-15.1.2.tgz", + "integrity": "sha512-on3h1iXb04QFLLThrmVYg1SChBQ9N1c+nKAjebBjokBqipddH3uxmOUcEkTnzmJ8Jh/5TSUnUqS40i2QB2dJHQ==", "requires": { + "@opentelemetry/api": "^1.4.0", "tdigest": "^0.1.1" } }, diff --git a/package.json b/package.json index 62f8fa6..40d144d 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@types/supertest": "^6.0.2", "chalk": "^4.1.2", "chokidar": "^3.6.0", - "prom-client": "^14.2.0", + "prom-client": "^15.1.2", "response-time": "^2.3.2", "rollup": "^4.14.3", "undici": "^5.27.2", diff --git a/run-tests.sh b/run-tests.sh index a5feece..b069832 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -33,6 +33,11 @@ runPrismaTests() { npm run vitest -t ./tests/prisma/*.test.ts } +# Run MySQL tests +runMysqlTests() { + npm run vitest -t ./tests/mysql2.test.ts +} + # Check if a variable is passed if [ "$1" = "express" ]; then npm run vitest -t ./tests/express.test.ts @@ -47,6 +52,8 @@ elif [ "$1" = "nestjs" ]; then runNestJsTests elif [ "$1" = "prisma" ]; then runPrismaTests +elif [ "$1" = "mysql2" ]; then + runAllTests else runAllTests fi \ No newline at end of file diff --git a/tests/mysql2.test.ts b/tests/mysql2.test.ts index 5933fbd..7ed0731 100644 --- a/tests/mysql2.test.ts +++ b/tests/mysql2.test.ts @@ -88,7 +88,7 @@ describe('mysql2', () => { expect( // @ts-ignore histogram.hashMap[ - 'database_name:test_db,query:SELECT * FROM users;,status:success' + 'database_name:test_db,query:SELECT * FROM users;,status:success,' ]?.count ).toBe(NUMBER_OF_REQUESTS); }); @@ -105,7 +105,7 @@ describe('mysql2', () => { expect( // @ts-ignore histogram.hashMap[ - 'database_name:test_db,query:SELECT * FROM user;,status:failure' + 'database_name:test_db,query:SELECT * FROM user;,status:failure,' ]?.count ).toBe(NUMBER_OF_REQUESTS); }); @@ -126,7 +126,7 @@ describe('mysql2', () => { expect( // @ts-ignore histogram.hashMap[ - 'database_name:test_db,query:SELECT * FROM users;,status:success' + 'database_name:test_db,query:SELECT * FROM users;,status:success,' ]?.count ).toBe(NUMBER_OF_REQUESTS * 2); }); @@ -143,7 +143,7 @@ describe('mysql2', () => { expect( // @ts-ignore histogram.hashMap[ - 'database_name:test_db,query:SELECT * FROM users;,status:success' + 'database_name:test_db,query:SELECT * FROM users;,status:success,' ]?.count ).toBe(NUMBER_OF_REQUESTS * 2); });