3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-14 21:31:50 +00:00

wip debug/clinic js

This commit is contained in:
Dragory 2023-04-29 19:44:08 +03:00
parent 025e67d6b6
commit 501b80f4a4
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
6 changed files with 50 additions and 6 deletions

View file

@ -8,6 +8,7 @@
"name": "@zeppelin/backend",
"version": "0.0.1",
"dependencies": {
"@clinic/heap-profiler": "^4.1.0",
"@silvia-odwyer/photon-node": "^0.3.1",
"bufferutil": "^4.0.3",
"clinic": "^12.1.0",

View file

@ -8,14 +8,12 @@
"watch-yaml-parse-test": "cross-env NODE_ENV=development tsc-watch --onSuccess \"node dist/backend/src/yamlParseTest.js\"",
"build": "rimraf dist && tsc",
"start-bot-dev": "cross-env NODE_ENV=development node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9229 dist/backend/src/index.js",
"start-bot-dev-debug": "NODE_ENV=development clinic heapprofiler --collect-only --dest .clinic-bot -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9229 dist/backend/src/index.js",
"start-bot-prod": "cross-env NODE_ENV=production node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/index.js",
"start-bot-prod-debug": "NODE_ENV=production clinic heapprofiler --collect-only --dest .clinic-bot -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/index.js",
"start-bot-prod-debug": "cross-env NODE_ENV=production node start-bot-prod-debug.js",
"watch-bot": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-bot-dev\"",
"start-api-dev": "cross-env NODE_ENV=development node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9239 dist/backend/src/api/index.js",
"start-api-dev-debug": "NODE_ENV=development clinic heapprofiler --collect-only --dest .clinic-api -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9239 dist/backend/src/api/index.js",
"start-api-prod": "cross-env NODE_ENV=production node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/api/index.js",
"start-api-prod-debug": "NODE_ENV=production clinic heapprofiler --collect-only --dest .clinic-api -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/api/index.js",
"start-api-prod-debug": "cross-env NODE_ENV=production node start-api-prod-debug.js",
"watch-api": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-api-dev\"",
"typeorm": "node -r ./register-tsconfig-paths.js ./node_modules/typeorm/cli.js",
"migrate-prod": "cross-env NODE_ENV=production npm run typeorm -- migration:run",
@ -27,6 +25,7 @@
"test-watch": "tsc-watch --onSuccess \"npx ava\""
},
"dependencies": {
"@clinic/heap-profiler": "^4.1.0",
"@silvia-odwyer/photon-node": "^0.3.1",
"bufferutil": "^4.0.3",
"clinic": "^12.1.0",

View file

@ -0,0 +1,22 @@
const ClinicHeapProfiler = require('@clinic/heap-profiler');
const heapProfiler = new ClinicHeapProfiler({
name: `api-${Date.now()}`,
collectOnFailure: true,
});
console.log("Starting API with heap collection");
heapProfiler.collect([
"node",
"-r",
"./register-tsconfig-paths.js",
"--unhandled-rejections=strict",
"--enable-source-maps",
"--stack-trace-limit=30",
"dist/backend/src/api/index.js"
], function (err, filepath) {
if (err) {
throw err;
}
console.log(`Saved collected data in ${filepath}`);
});

View file

@ -0,0 +1,22 @@
const ClinicHeapProfiler = require('@clinic/heap-profiler');
const heapProfiler = new ClinicHeapProfiler({
name: `bot-${Date.now()}`,
collectOnFailure: true,
});
console.log("Starting bot with heap collection");
heapProfiler.collect([
"node",
"-r",
"./register-tsconfig-paths.js",
"--unhandled-rejections=strict",
"--enable-source-maps",
"--stack-trace-limit=30",
"dist/backend/src/index.js"
], function (err, filepath) {
if (err) {
throw err;
}
console.log(`Saved collected data in ${filepath}`);
});

View file

@ -11,7 +11,7 @@ while ping -c1 prepare_backend &>/dev/null; do sleep 1; done;
cd /zeppelin/backend
if [ -n "$DEBUG" ]; then
echo "Starting API in debug mode"
exec env NO_INSIGHT=true npm run start-api-prod-debug
exec npm run start-api-prod-debug
else
echo "Starting API"
exec npm run start-api-prod

View file

@ -11,7 +11,7 @@ while ping -c1 prepare_backend &>/dev/null; do sleep 1; done;
cd /zeppelin/backend
if [ -n "$DEBUG" ]; then
echo "Starting bot in debug mode"
exec env NO_INSIGHT=true npm run start-bot-prod-debug
exec npm run start-bot-prod-debug
else
echo "Starting bot"
exec npm run start-bot-prod