diff --git a/examples/node-1/package-lock.json b/examples/node-1/package-lock.json index 098f9d7..4a70ba6 100644 --- a/examples/node-1/package-lock.json +++ b/examples/node-1/package-lock.json @@ -10,6 +10,8 @@ "license": "MIT", "dependencies": { "express": "^4.18.2", + "scylla_pg_client": "^0.1.19", + "uuid": "^9.0.1", "winston": "^3.11.0" }, "devDependencies": { @@ -784,6 +786,93 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "node_modules/scylla_pg_client": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_client/-/scylla_pg_client-0.1.19.tgz", + "integrity": "sha512-Kys7wxxLW9zcFGjHrNC833w060WV7v1hAHUt2rTk8/JqoYtW34uH2IWr/+4W7+jY4b+o38RtIyCyUjsi57pRLA==", + "dependencies": { + "scylla_pg_js": "0.1.19" + }, + "engines": { + "node": ">=14.16.1", + "npm": ">=6.14.12" + } + }, + "node_modules/scylla_pg_js": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js/-/scylla_pg_js-0.1.19.tgz", + "integrity": "sha512-XBJlqSEhPUlse82TwRKHptottvh4XXwI9KyCN1XhQId/iAPzSza8SAD6x+RifVDGbTay1L1EqKEak2y5FmjUHQ==", + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "scylla_pg_js-darwin-arm64": "0.1.19", + "scylla_pg_js-darwin-universal": "0.1.19", + "scylla_pg_js-darwin-x64": "0.1.19", + "scylla_pg_js-linux-x64-gnu": "0.1.19", + "scylla_pg_js-win32-x64-msvc": "0.1.19" + } + }, + "node_modules/scylla_pg_js-darwin-arm64": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-darwin-arm64/-/scylla_pg_js-darwin-arm64-0.1.19.tgz", + "integrity": "sha512-cfzfdT+yBA5yEY8/iKElasWzpe8d5xW6BJ45GsftpFL0Q5UCKuDqgCl8xHBJ53c7HITX5MD4rY9akJFXuG+SsQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/scylla_pg_js-darwin-x64": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-darwin-x64/-/scylla_pg_js-darwin-x64-0.1.19.tgz", + "integrity": "sha512-rhRRwqPVrbBLnfCHbsaqoWjOLDCkBgEfUVSSs/R1N7btgPoyc0TeUJe7ONRVFVH1oUZsY7+oQ8O2BW5YorRpaw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/scylla_pg_js-linux-x64-gnu": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-linux-x64-gnu/-/scylla_pg_js-linux-x64-gnu-0.1.19.tgz", + "integrity": "sha512-ah1vdLES9fNd5Uc304v/bedL76ecCfFBmr+0TWOlsyPgrY0aqpvA2hpA6VIenGOT4mbUqT16+46cD/ODCybvGw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/scylla_pg_js-win32-x64-msvc": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-win32-x64-msvc/-/scylla_pg_js-win32-x64-msvc-0.1.19.tgz", + "integrity": "sha512-8+TQCZ2Uy8RTWQZxBGkESc98Vn91Gkkw+bSNTk0HSivzrRo88UJPoLUoKnx4LIZv3LlxisWSmA/JvU7d3NKtbw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -963,6 +1052,18 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -1612,6 +1713,50 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "scylla_pg_client": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_client/-/scylla_pg_client-0.1.19.tgz", + "integrity": "sha512-Kys7wxxLW9zcFGjHrNC833w060WV7v1hAHUt2rTk8/JqoYtW34uH2IWr/+4W7+jY4b+o38RtIyCyUjsi57pRLA==", + "requires": { + "scylla_pg_js": "0.1.19" + } + }, + "scylla_pg_js": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js/-/scylla_pg_js-0.1.19.tgz", + "integrity": "sha512-XBJlqSEhPUlse82TwRKHptottvh4XXwI9KyCN1XhQId/iAPzSza8SAD6x+RifVDGbTay1L1EqKEak2y5FmjUHQ==", + "requires": { + "scylla_pg_js-darwin-arm64": "0.1.19", + "scylla_pg_js-darwin-universal": "0.1.19", + "scylla_pg_js-darwin-x64": "0.1.19", + "scylla_pg_js-linux-x64-gnu": "0.1.19", + "scylla_pg_js-win32-x64-msvc": "0.1.19" + } + }, + "scylla_pg_js-darwin-arm64": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-darwin-arm64/-/scylla_pg_js-darwin-arm64-0.1.19.tgz", + "integrity": "sha512-cfzfdT+yBA5yEY8/iKElasWzpe8d5xW6BJ45GsftpFL0Q5UCKuDqgCl8xHBJ53c7HITX5MD4rY9akJFXuG+SsQ==", + "optional": true + }, + "scylla_pg_js-darwin-x64": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-darwin-x64/-/scylla_pg_js-darwin-x64-0.1.19.tgz", + "integrity": "sha512-rhRRwqPVrbBLnfCHbsaqoWjOLDCkBgEfUVSSs/R1N7btgPoyc0TeUJe7ONRVFVH1oUZsY7+oQ8O2BW5YorRpaw==", + "optional": true + }, + "scylla_pg_js-linux-x64-gnu": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-linux-x64-gnu/-/scylla_pg_js-linux-x64-gnu-0.1.19.tgz", + "integrity": "sha512-ah1vdLES9fNd5Uc304v/bedL76ecCfFBmr+0TWOlsyPgrY0aqpvA2hpA6VIenGOT4mbUqT16+46cD/ODCybvGw==", + "optional": true + }, + "scylla_pg_js-win32-x64-msvc": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-win32-x64-msvc/-/scylla_pg_js-win32-x64-msvc-0.1.19.tgz", + "integrity": "sha512-8+TQCZ2Uy8RTWQZxBGkESc98Vn91Gkkw+bSNTk0HSivzrRo88UJPoLUoKnx4LIZv3LlxisWSmA/JvU7d3NKtbw==", + "optional": true + }, "send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -1753,6 +1898,11 @@ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" }, + "uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/examples/node-1/package.json b/examples/node-1/package.json index 01128bf..f4f3b2e 100644 --- a/examples/node-1/package.json +++ b/examples/node-1/package.json @@ -25,6 +25,8 @@ }, "dependencies": { "express": "^4.18.2", + "scylla_pg_client": "^0.1.19", + "uuid": "^9.0.1", "winston": "^3.11.0" } } diff --git a/examples/node-1/pit-test-app/package-lock.json b/examples/node-1/pit-test-app/package-lock.json index 8a0e2a7..d36ace2 100644 --- a/examples/node-1/pit-test-app/package-lock.json +++ b/examples/node-1/pit-test-app/package-lock.json @@ -10,7 +10,10 @@ "license": "MIT", "dependencies": { "express": "^4.18.2", + "hdr-histogram-js": "^3.0.0", "node-fetch": "^3.3.2", + "scylla_pg_client": "^0.1.19", + "uuid": "^9.0.1", "winston": "^3.11.0" }, "devDependencies": { @@ -18,6 +21,11 @@ "typescript": "^5.2.2" } }, + "node_modules/@assemblyscript/loader": { + "version": "0.19.23", + "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.19.23.tgz", + "integrity": "sha512-ulkCYfFbYj01ie1MDOyxv2F6SpRN1TOj7fQxbP07D6HmeR+gr2JLSmINKjga2emB+b1L2KGrFKBTc+e00p54nw==" + }, "node_modules/@colors/colors": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", @@ -72,6 +80,25 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -464,6 +491,19 @@ "node": ">= 0.4" } }, + "node_modules/hdr-histogram-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hdr-histogram-js/-/hdr-histogram-js-3.0.0.tgz", + "integrity": "sha512-/EpvQI2/Z98mNFYEnlqJ8Ogful8OpArLG/6Tf2bPnkutBVLIeMVNHjk1ZDfshF2BUweipzbk+dB1hgSB7SIakw==", + "dependencies": { + "@assemblyscript/loader": "^0.19.21", + "base64-js": "^1.2.0", + "pako": "^1.0.3" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -666,6 +706,11 @@ "fn.name": "1.x.x" } }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -772,6 +817,93 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "node_modules/scylla_pg_client": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_client/-/scylla_pg_client-0.1.19.tgz", + "integrity": "sha512-Kys7wxxLW9zcFGjHrNC833w060WV7v1hAHUt2rTk8/JqoYtW34uH2IWr/+4W7+jY4b+o38RtIyCyUjsi57pRLA==", + "dependencies": { + "scylla_pg_js": "0.1.19" + }, + "engines": { + "node": ">=14.16.1", + "npm": ">=6.14.12" + } + }, + "node_modules/scylla_pg_js": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js/-/scylla_pg_js-0.1.19.tgz", + "integrity": "sha512-XBJlqSEhPUlse82TwRKHptottvh4XXwI9KyCN1XhQId/iAPzSza8SAD6x+RifVDGbTay1L1EqKEak2y5FmjUHQ==", + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "scylla_pg_js-darwin-arm64": "0.1.19", + "scylla_pg_js-darwin-universal": "0.1.19", + "scylla_pg_js-darwin-x64": "0.1.19", + "scylla_pg_js-linux-x64-gnu": "0.1.19", + "scylla_pg_js-win32-x64-msvc": "0.1.19" + } + }, + "node_modules/scylla_pg_js-darwin-arm64": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-darwin-arm64/-/scylla_pg_js-darwin-arm64-0.1.19.tgz", + "integrity": "sha512-cfzfdT+yBA5yEY8/iKElasWzpe8d5xW6BJ45GsftpFL0Q5UCKuDqgCl8xHBJ53c7HITX5MD4rY9akJFXuG+SsQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/scylla_pg_js-darwin-x64": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-darwin-x64/-/scylla_pg_js-darwin-x64-0.1.19.tgz", + "integrity": "sha512-rhRRwqPVrbBLnfCHbsaqoWjOLDCkBgEfUVSSs/R1N7btgPoyc0TeUJe7ONRVFVH1oUZsY7+oQ8O2BW5YorRpaw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/scylla_pg_js-linux-x64-gnu": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-linux-x64-gnu/-/scylla_pg_js-linux-x64-gnu-0.1.19.tgz", + "integrity": "sha512-ah1vdLES9fNd5Uc304v/bedL76ecCfFBmr+0TWOlsyPgrY0aqpvA2hpA6VIenGOT4mbUqT16+46cD/ODCybvGw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/scylla_pg_js-win32-x64-msvc": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-win32-x64-msvc/-/scylla_pg_js-win32-x64-msvc-0.1.19.tgz", + "integrity": "sha512-8+TQCZ2Uy8RTWQZxBGkESc98Vn91Gkkw+bSNTk0HSivzrRo88UJPoLUoKnx4LIZv3LlxisWSmA/JvU7d3NKtbw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -946,6 +1078,18 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -998,6 +1142,11 @@ } }, "dependencies": { + "@assemblyscript/loader": { + "version": "0.19.23", + "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.19.23.tgz", + "integrity": "sha512-ulkCYfFbYj01ie1MDOyxv2F6SpRN1TOj7fQxbP07D6HmeR+gr2JLSmINKjga2emB+b1L2KGrFKBTc+e00p54nw==" + }, "@colors/colors": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz", @@ -1046,6 +1195,11 @@ "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, "body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -1347,6 +1501,16 @@ "function-bind": "^1.1.2" } }, + "hdr-histogram-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hdr-histogram-js/-/hdr-histogram-js-3.0.0.tgz", + "integrity": "sha512-/EpvQI2/Z98mNFYEnlqJ8Ogful8OpArLG/6Tf2bPnkutBVLIeMVNHjk1ZDfshF2BUweipzbk+dB1hgSB7SIakw==", + "requires": { + "@assemblyscript/loader": "^0.19.21", + "base64-js": "^1.2.0", + "pako": "^1.0.3" + } + }, "http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -1484,6 +1648,11 @@ "fn.name": "1.x.x" } }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, "parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -1552,6 +1721,50 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "scylla_pg_client": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_client/-/scylla_pg_client-0.1.19.tgz", + "integrity": "sha512-Kys7wxxLW9zcFGjHrNC833w060WV7v1hAHUt2rTk8/JqoYtW34uH2IWr/+4W7+jY4b+o38RtIyCyUjsi57pRLA==", + "requires": { + "scylla_pg_js": "0.1.19" + } + }, + "scylla_pg_js": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js/-/scylla_pg_js-0.1.19.tgz", + "integrity": "sha512-XBJlqSEhPUlse82TwRKHptottvh4XXwI9KyCN1XhQId/iAPzSza8SAD6x+RifVDGbTay1L1EqKEak2y5FmjUHQ==", + "requires": { + "scylla_pg_js-darwin-arm64": "0.1.19", + "scylla_pg_js-darwin-universal": "0.1.19", + "scylla_pg_js-darwin-x64": "0.1.19", + "scylla_pg_js-linux-x64-gnu": "0.1.19", + "scylla_pg_js-win32-x64-msvc": "0.1.19" + } + }, + "scylla_pg_js-darwin-arm64": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-darwin-arm64/-/scylla_pg_js-darwin-arm64-0.1.19.tgz", + "integrity": "sha512-cfzfdT+yBA5yEY8/iKElasWzpe8d5xW6BJ45GsftpFL0Q5UCKuDqgCl8xHBJ53c7HITX5MD4rY9akJFXuG+SsQ==", + "optional": true + }, + "scylla_pg_js-darwin-x64": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-darwin-x64/-/scylla_pg_js-darwin-x64-0.1.19.tgz", + "integrity": "sha512-rhRRwqPVrbBLnfCHbsaqoWjOLDCkBgEfUVSSs/R1N7btgPoyc0TeUJe7ONRVFVH1oUZsY7+oQ8O2BW5YorRpaw==", + "optional": true + }, + "scylla_pg_js-linux-x64-gnu": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-linux-x64-gnu/-/scylla_pg_js-linux-x64-gnu-0.1.19.tgz", + "integrity": "sha512-ah1vdLES9fNd5Uc304v/bedL76ecCfFBmr+0TWOlsyPgrY0aqpvA2hpA6VIenGOT4mbUqT16+46cD/ODCybvGw==", + "optional": true + }, + "scylla_pg_js-win32-x64-msvc": { + "version": "0.1.19", + "resolved": "https://registry.npmjs.org/scylla_pg_js-win32-x64-msvc/-/scylla_pg_js-win32-x64-msvc-0.1.19.tgz", + "integrity": "sha512-8+TQCZ2Uy8RTWQZxBGkESc98Vn91Gkkw+bSNTk0HSivzrRo88UJPoLUoKnx4LIZv3LlxisWSmA/JvU7d3NKtbw==", + "optional": true + }, "send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -1686,6 +1899,11 @@ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" }, + "uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/examples/node-1/pit-test-app/package.json b/examples/node-1/pit-test-app/package.json index b01ed90..ca88909 100644 --- a/examples/node-1/pit-test-app/package.json +++ b/examples/node-1/pit-test-app/package.json @@ -23,8 +23,11 @@ "start": "node dist/index.js" }, "dependencies": { - "node-fetch": "^3.3.2", "express": "^4.18.2", + "hdr-histogram-js": "^3.0.0", + "node-fetch": "^3.3.2", + "scylla_pg_client": "^0.1.19", + "uuid": "^9.0.1", "winston": "^3.11.0" } } diff --git a/examples/node-1/pit-test-app/src/report/schema-v1.ts b/examples/node-1/pit-test-app/src/report/schema-v1.ts index de1ebad..9b86a1e 100644 --- a/examples/node-1/pit-test-app/src/report/schema-v1.ts +++ b/examples/node-1/pit-test-app/src/report/schema-v1.ts @@ -16,7 +16,7 @@ export class ScalarMetric { export class DistributionMetric { type: MetricType = MetricType.DISTRIBUTION value: any - constructor(readonly name: string, value: Map) { + constructor(readonly name: string, value: Map) { this.value = Object.fromEntries(value.entries()) } } diff --git a/examples/node-1/pit-test-app/src/utils.ts b/examples/node-1/pit-test-app/src/utils.ts new file mode 100644 index 0000000..e69de29 diff --git a/examples/node-1/pit-test-app/src/web-api/service.ts b/examples/node-1/pit-test-app/src/web-api/service.ts index 92906cb..9f2c6d9 100644 --- a/examples/node-1/pit-test-app/src/web-api/service.ts +++ b/examples/node-1/pit-test-app/src/web-api/service.ts @@ -1,26 +1,45 @@ -import { Express, Request, Response, response } from 'express' -import fetch from "node-fetch" +import {Express, Request, Response, response} from "express"; +// import fetch from "node-fetch" -import { logger } from "../logger.js" -import * as webapi from './schema-v1.js' -import * as report from '../report/schema-v1.js' +import {logger} from "../logger.js"; +import * as webapi from "./schema-v1.js"; +import * as report from "../report/schema-v1.js"; +import ScyllaManager, { + AddTaskModel, + DbConfig, + GetTaskModel, + Task, + TaskStatus, +} from "scylla_pg_client"; +import {v4 as uuid} from "uuid"; +import * as hdr from "hdr-histogram-js"; export class WebService { - private globalSessionId: number = 0 + private globalSessionId: number = 0; private sessions: Map = new Map() constructor(readonly app: Express, readonly targetServiceUrl: string) { - app.post("/start", async (req: Request, res: Response) => this.postStart(req, res)) - app.get("/status", async (req: Request, res: Response) => this.getStatus(req, res)) - app.get("/reports", async (req: Request, res: Response) => this.getReports(req, res)) + app.post("/start", async (req: Request, res: Response) => + this.postStart(req, res) + ) + app.get("/status", async (req: Request, res: Response) => + this.getStatus(req, res) + ) + app.get("/reports", async (req: Request, res: Response) => + this.getReports(req, res) + ) } private async postStart(req: Request, res: Response) { - const sessionId = ++this.globalSessionId - const startRequest = req.body as webapi.StartRequest + const sessionId = ++this.globalSessionId; + // const startRequest = req.body as webapi.StartRequest; + const startRequest = req.body ; - const sessionMeta = { sessionId, testSuiteId: startRequest.testSuiteId } - this.sessions.set(sessionId, { status: webapi.TestStatus.PENDING, ...sessionMeta }) + const sessionMeta = {sessionId, testSuiteId: startRequest.testSuiteId}; + this.sessions.set(sessionId, { + status: webapi.TestStatus.PENDING, + ...sessionMeta, + }) try { logger.info("Running test: '%s'", startRequest.testSuiteId) @@ -29,19 +48,29 @@ export class WebService { const scenarios = await this.runTests( startRequest.testSuiteId, sessionId, + startRequest.iterationsCount // temp for ease of execution ) const reportEnvelope = new webapi.ReportEnvelope(scenarios) - this.sessions.set(sessionId, { status: webapi.TestStatus.COMPLETED, reportEnvelope, ...sessionMeta }) + this.sessions.set(sessionId, { + status: webapi.TestStatus.COMPLETED, + reportEnvelope, + ...sessionMeta, + }) } catch (e) { - this.sessions.set(sessionId, { status: webapi.TestStatus.ERROR, error: e.message, ...sessionMeta }) + this.sessions.set(sessionId, { + status: webapi.TestStatus.ERROR, + error: e.message, + ...sessionMeta, + }) logger.error("Message: %s", e.message) if (e.cause) logger.error(e.cause) if (e.stack) logger.error("Stack:\n%s", e.stack) } }, 0) - res.json(new webapi.StartResponse(sessionId.toString(), startRequest.testSuiteId)) - + res.json( + new webapi.StartResponse(sessionId.toString(), startRequest.testSuiteId) + ) } catch (e) { logger.error("Message: %s", e.message) if (e.cause) logger.error(e.cause) @@ -53,55 +82,60 @@ export class WebService { private async getStatus(req: Request, res: Response) { let sessionId: any = req.query["sessionId"] if (!sessionId) { - res.status(422).send("Invalid parameter \"sessionId\"") - return + res.status(422).send('Invalid parameter "sessionId"') + return; } sessionId = parseInt(sessionId + "") if (!this.sessions.has(sessionId)) { res.status(422).send("No such session") - return + return; } - const { testSuiteId, status } = this.sessions.get(sessionId) + const {testSuiteId, status} = this.sessions.get(sessionId) res.json(new webapi.StatusResponse(sessionId, testSuiteId, status)) } private async getReports(req: Request, res: Response) { let sessionId: any = req.query["sessionId"] if (!sessionId) { - res.status(422).send("Invalid parameter \"sessionId\"") - return + res.status(422).send('Invalid parameter "sessionId"') + return; } sessionId = parseInt(sessionId + "") if (!this.sessions.has(sessionId)) { res.status(422).send("No such session") - return + return; } - const { status, testSuiteId, reportEnvelope, error } = this.sessions.get(sessionId) + const {status, testSuiteId, reportEnvelope, error} = + this.sessions.get(sessionId) if (status !== webapi.TestStatus.COMPLETED) { - res.json(new webapi.ReportResponse(sessionId, testSuiteId, status, null, error)) - return + res.json( + new webapi.ReportResponse(sessionId, testSuiteId, status, null, error) + ) + return; } - res.json(new webapi.ReportResponse(sessionId, testSuiteId, status, reportEnvelope)) + res.json( + new webapi.ReportResponse(sessionId, testSuiteId, status, reportEnvelope) + ) } - private async runTests(testSuiteId: string, sessionId: number): Promise> { - this.sessions.get(sessionId).status = webapi.TestStatus.RUNNING + private async runTests( + testSuiteId: string, + sessionId: number, + iterationsCount: number + ): Promise> { + this.sessions.get(sessionId).status = webapi.TestStatus.RUNNING; const specs = [ + { - iterations: 100, - name: "GET /time x 100", - requirements: [ new report.ScalarMetric("throughput", 600) ] - }, - { - iterations: 10000, - name: "GET /time x 10000", - requirements: [ new report.ScalarMetric("throughput", 1000) ] + // iterations: 1000, + name: 'Complete Task Flow', + requirements: [new report.ScalarMetric("p95", 300)], } ] @@ -109,56 +143,168 @@ export class WebService { for (let spec of specs) { const startedAt = new Date() - const stats = await this.runTestScenario(testSuiteId, spec.iterations) + const stats = await this.runTestScenario(testSuiteId, iterationsCount,spec.name) const finishedAt = new Date() const elapsedMs = finishedAt.getTime() - startedAt.getTime() - const rate = stats.requests / (elapsedMs / 1_000.0) - const outcome = rate >= spec.requirements[0].value ? report.TestOutcomeType.PASS : report.TestOutcomeType.FAIL - const throughput = new report.ScalarMetric("throughput", rate) - const stream = new report.TestStream("default", spec.requirements, [ throughput ], outcome) - const scenario = new webapi.ExecutedTestScenario(spec.name, startedAt, finishedAt, [ stream ], [ "node-1" ]) + const objectToMap = obj => new Map(Object.entries(obj)); + const summaryMap = objectToMap(stats.summary) + + const rate = summaryMap["p90"] + const outcome = + rate >= spec.requirements[0].value + ? report.TestOutcomeType.PASS + : report.TestOutcomeType.FAIL; + const throughput = new report.ScalarMetric("throughput", 1000) + console.log("stats: ", stats.summary, typeof stats.summary) + const distribution = new report.DistributionMetric("stats", summaryMap) + const stream = new report.TestStream( + "default", + spec.requirements, + [distribution], + report.TestOutcomeType.PASS + ) + const scenario = new webapi.ExecutedTestScenario( + spec.name, + startedAt, + finishedAt, + [stream], + ["node-1"] + ) scenarios.push(scenario) } - return scenarios + return scenarios; } - private async runTestScenario(_testSuiteId: string, iterationsCount: number): Promise { - const endpoint = `${ this.targetServiceUrl }/time` - const stats = { min: -1, max: -1, avg: -1, duration: 0, requests: 0 } - const errors = { system: 0, api: 0 } - - for (let i = 1; i <= iterationsCount; i++) { - try { - const start = new Date() - const response = await fetch(endpoint) - if (!response.ok) { - errors.api++ - continue - } + private async runTestScenario( + _testSuiteId: string, + iterationsCount: number, + flowName: string + ): Promise { + // const endpoint = `${ this.targetServiceUrl }/addTask` + // console.log("start API test scenario:",endpoint) + const dbConfig: DbConfig = { + pgHost: "localhost", + pgPort: 5432, + pgUser: "postgres", + pgPassword: "postgres", + pgDatabase: "scylla", + pgPoolSize: 10, + }; + const scyllaManager = await ScyllaManager.initiate(dbConfig) - const duration = new Date().getTime() - start.getTime() - if (stats.min == -1) { - stats.min = duration - stats.max = duration - stats.avg = duration - stats.requests = 1 - stats.duration = duration - } else { - stats.requests++ - stats.min = Math.min(stats.min, duration) - stats.max = Math.max(stats.max, duration) - stats.duration += duration - stats.avg = stats.duration / stats.requests - } + const stats = {min: -1, max: -1, avg: -1, duration: 0, requests: 0}; + const errors = {system: 0, api: 0}; + + let promises = [] + + const sleep = (ms: number) => { + return new Promise(resolve => setTimeout(resolve, ms)) + }; + const addTask = async () => { + const task: AddTaskModel = { + rn: uuid(), + queue: "test", + spec: {}, + priority: 1, + }; + return await scyllaManager.addTask(task) + // await fetch(endpoint,{ + // method: 'GET', + // headers: { + // 'Content-Type': 'application/json', + // "Accept": "application/json" + // }, + // }) + }; + + const start = new Date() + + + const h = hdr.build() + try { + //Listener + // for (let i = 0; i < iterationsCount; i++) { + // promises.push( + // startTimes[i] = new Date().getTime(), + // new Promise(async resolved => { + // let outcome = await addTask() + // console.log("outcome: ", outcome) + // sleep(10) + // endTimes[i] = new Date().getTime() + // return resolved(outcome) + // }) + // ) + + // } - } catch (e) { - logger.error(e) - errors.system++ + // await Promise.all(promises) + + //worker + + const workerFlow = async () => { + const startTime = new Date().getTime() + let timeElapsed = 0; + const task: Task = await addTask() + let leasedTask; + let completedTask; + // Right now No retries + if(!!task?.rn) { + leasedTask = await scyllaManager.leaseTask(task?.rn,'scylla-test-app') + } + if(!!leasedTask?.rn) { + completedTask = await scyllaManager.completeTask(leasedTask?.rn) } + if(!!completedTask?.rn) { + const endTimes = new Date().getTime() + timeElapsed = endTimes - startTime + // h.recordValue(timeElapsed[index]) + } + + return timeElapsed + } + //break iterationsCount into chunks of 100 + const chunkSize = 100 + let chunks = iterationsCount + let counter = 0 + while (chunks > 0) { + + promises = [] + for (let j = 0; j < chunkSize; j++) { + promises.push( + new Promise(async resolved => { + let outcome = await workerFlow() + h.recordValue(outcome) + return resolved(outcome) + }) + ) + counter++ + sleep(10) + } + await Promise.all(promises) + chunks = chunks - chunkSize + } + + + stats.requests = iterationsCount + + // console.log(`Statistics for worker flow ${h}`) + + } catch (err) { + // no retries + console.log("Error: ", err) + } finally { + console.log("Finally") + const timeElapsed = (new Date().getTime() - start.getTime())/1000; + console.log(`Time elapsed: ${timeElapsed} s`) + const rate = iterationsCount / timeElapsed; + console.log(`Rate: ${rate} calls/s`) + } - return stats + return h; } -} \ No newline at end of file + + +} diff --git a/examples/node-1/src/pool.js b/examples/node-1/src/pool.js deleted file mode 100644 index 5f6d861..0000000 --- a/examples/node-1/src/pool.js +++ /dev/null @@ -1,7 +0,0 @@ -async function submit(task) { - return new Promise((resolve, reject) => { - task().then(resolve).catch(reject); - }); - - -} \ No newline at end of file diff --git a/examples/node-1/src/pool_test.js b/examples/node-1/src/pool_test.js deleted file mode 100644 index 8aad83b..0000000 --- a/examples/node-1/src/pool_test.js +++ /dev/null @@ -1,88 +0,0 @@ -// function testPromise1(){ -// return new Promise((resolve, reject) => { -// setTimeout(() => { -// resolve('ok1'); -// }, 1000); -// }); -// } -// function testPromise2(){ -// return new Promise((resolve, reject) => { -// setTimeout(() => { -// resolve('ok2'); -// }, 100); -// }); -// } -// function testPromise3(){ -// return new Promise((resolve, reject) => { -// setTimeout(() => { -// resolve('ok3'); -// }, 10); -// }); -// } - -// async function test(){ -// let live = 0; -// let backlog = new Array(); -// // add testPromise to backlog -// backlog.push(testPromise1); -// backlog.push(testPromise2); -// backlog.push(testPromise3); - -// // run all testPromise in parallel -// let results = await Promise.all(backlog.map(func => func())); -// // let res = await testPromise(); -// console.log(results); -// } - -// test(); - - -function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} - -var globalList = Array(); -globalList.push("Test"); -globalList.push("Another Test"); - -async function coreFunc(promiseName, sleepTime) { - console.log("Started CoreFunc: "+promiseName); - - var localList = [...globalList]; - - console.log("Length of local array: "+localList.length); - console.log("Length of global array: "+globalList.length); - - if (promiseName != "Promise0") { - for ( var i = 0; i < localList.length; i++) { - console.log(localList[i]); - } - } - - if (promiseName == "Promise0") { - var testList = new Array(); - testList[0] = "Changed"; - globalList = testList; - } - await sleep(sleepTime); - - console.log("Length of local array: "+localList.length); - console.log("Length of global array: "+globalList.length); - - console.log("Done with CoreFunc: "+promiseName); -} - -async function testMultiplePromises() { - var thArray = Array(); - - for ( var i = 0; i < 4; i++) { - var pr = new Promise(resolve => coreFunc("Promise" + i, 3000)); - thArray[i] = pr; - } - - for ( var i = 0; i < thArray.length; i++) { - await thArray[i]; - } -} - -testMultiplePromises() \ No newline at end of file diff --git a/examples/node-1/src/throttled_1.js b/examples/node-1/src/throttled_1.js index 4f9c213..47c7bea 100644 --- a/examples/node-1/src/throttled_1.js +++ b/examples/node-1/src/throttled_1.js @@ -2,24 +2,65 @@ const sleep = milliseconds => { return new Promise(resolve => setTimeout(resolve, milliseconds)); }; -async function throttle_call() { +async function throttle_call(numOfCalls, task) { const startTime = new Date(); - const calls = 50000; + const calls = numOfCalls; let promises = []; for (let i = 0; i < calls; i++) { promises.push( new Promise(async resolved => { - await sleep(1000); - resolved(); + let outcome = await task(); + resolved(outcome); }) ); - // if (1 == calls - 1) { + // if (i == calls/2) { // // Rate drops by 200/s with this sleep - // await sleep(10); + // await sleep(0); // } } + /** + * When I dont have the try block of promise all without batching + * node:internal/deps/undici/undici:11576 + Error.captureStackTrace(err, this); + ^ + +TypeError: fetch failed + at Object.fetch (node:internal/deps/undici/undici:11576:11) + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + at async task (file:///Users/amnkau/code/kindred_github/pit-toolkit/examples/node-1/src/throttled_1.js:60:3) + at async file:///Users/amnkau/code/kindred_github/pit-toolkit/examples/node-1/src/throttled_1.js:13:23 { + cause: AggregateError + at internalConnectMultiple (node:net:1114:18) + at afterConnectMultiple (node:net:1667:5) { + code: 'ETIMEDOUT', + [errors]: [ + Error: connect ETIMEDOUT ::1:62001 + at createConnectionError (node:net:1634:14) + at Timeout.internalConnectMultipleTimeout (node:net:1685:38) + at listOnTimeout (node:internal/timers:575:11) + at process.processTimers (node:internal/timers:514:7) { + errno: -60, + code: 'ETIMEDOUT', + syscall: 'connect', + address: '::1', + port: 62001 + }, + Error: connect ECONNRESET 127.0.0.1:62001 + at createConnectionError (node:net:1634:14) + at afterConnectMultiple (node:net:1664:40) { + errno: -54, + code: 'ECONNRESET', + syscall: 'connect', + address: '127.0.0.1', + port: 62001 + } + ] + } +} + */ try { + console.log("Promises: ",promises.length) if (promises.length > 500){ while (true){ // batch size can be played with not sure what the network @@ -28,7 +69,8 @@ async function throttle_call() { await Promise.all(batchPromise); if (promises.length == 0){ break - }else{ + } + else{ // Rate drops by 4000/s with this else block await sleep(0); continue @@ -36,6 +78,9 @@ async function throttle_call() { } + }else{ + await Promise.all(promises); + // console.log("single promis all Outcome: ",outcome) } }catch(err){ @@ -49,4 +94,17 @@ async function throttle_call() { } } -throttle_call(); \ No newline at end of file +const task = async () => { + const targetServiceUrl = "http://localhost:62001" + const endpoint = `${ targetServiceUrl }/addTask` + await fetch(endpoint,{ + method: 'GET', + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + } + + }); +} + +throttle_call(5000, task); \ No newline at end of file diff --git a/examples/node-1/src/throttled_api.js b/examples/node-1/src/throttled_api.js deleted file mode 100644 index 2cce6aa..0000000 --- a/examples/node-1/src/throttled_api.js +++ /dev/null @@ -1,60 +0,0 @@ - -const API = async(params)=> { - console.log("API called") -} - -function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} - -async function callAPI(params) { - - var countCalls = 50 - var startTime = new Date().getTime() - // console.log("callAPI : Start time: "+startTime) - var endTime = startTime + 1000; - let counter =0 - // while (countCalls > 0 && new Date().getTime() < endTime ) { - while (countCalls > 0 ){ - console.log("counter: "+ countCalls) - // Promise.resolve(API(params)) - await API(params) - // submit(await API(params)) - countCalls-- - } - var endTime = new Date().getTime() - if((endTime-startTime)/1000 > 1) { - console.log("Time taken: "+(endTime-startTime)/1000) - console.log("Need adjustments in the code") - } - // console.log("End of callAPI", ) - sleep(0) -} - -async function main(params) { - var startTime = new Date().getTime() - console.log("Start time: "+startTime) - var endTime = startTime + 8; - // console.log("End time: "+endTime) - // var countCalls = endTime-startTime; - - - let count = 0 - let sustainedRateForTime = 1 - // run all testPromise in parallel - // setInterval(() => { - // console.log("Interval") - // let results = Promise.all(backlog.map(func => func())); - // } - while (new Date().getTime() < endTime) { - // --countCalls - // console.log("countine",count++, countCalls) - // Promise.resolve( callAPI()) - await callAPI() - } - - var endMain = new Date().getTime() - console.log("*******************End of main************",endMain-startTime,"ms") -} - -await main()