clinicjs / node-clinic

Clinic.js diagnoses your Node.js performance issues
https://clinicjs.org
MIT License
5.69k stars 125 forks source link

How do I use clinic.js with nuxt? #455

Open sjahns opened 1 year ago

sjahns commented 1 year ago

I want to use clinic js for a nuxt application but have so far been unable to get it to work. I am at a loss at what the command has to look like. From what I have seen I need to give clinic a js file to execute.

I prepare a build with npm run build and then how do I continue? The only way I got something other than an error was clinic doctor -- node .nuxt/dist/server/server.js but that gives an empty analysis. How do I tell clinic js to analyse the page that I would find under "localhost:3000/jobs" for example? I tried things like clinic doctor --on-port 'wrk http://localhost:$PORT/jobs' -- node .nuxt/dist/server/server.js' clinic doctor --autocannon [ -m GET 'http://localhost:$PORT/jobs' ] -- node .nuxt/dist/server/server.js

But again I am not even sure if that is the correct file.

Thanks.

Environment

RafaelGSS commented 1 year ago

I tried things like clinic doctor --on-port 'wrk http://localhost:$PORT/jobs' -- node .nuxt/dist/server/server.js' clinic doctor --autocannon [ -m GET 'http://localhost:$PORT/jobs' ] -- node .nuxt/dist/server/server.js

That's correct, but you need to consider this will evaluate the server.js operations in the backend. This won't give you information about scripts evaluated in the front-end side.

sjahns commented 1 year ago

Yes I am aware, but those commands give me empty results. Profile data collected seems to be empty, report may not be generated Also it runs so quickly that i am sure it doesn't do anything.

RafaelGSS commented 1 year ago

Try changing it to:

$ clinic doctor --autocannon [ -d 30 -c 100 /jobs ] -- node .nuxt/dist/server/server.js
sjahns commented 1 year ago

Sorry for the delay, was busy the last week.

I get the same empty result with that command.

RafaelGSS commented 1 year ago

can you create a minimal reproducible code?

ly95 commented 1 year ago

same issue, after ctrl+c got error

Error: process exited by signal SIGABRT
    at ChildProcess.<anonymous> (/Users/xxx/.nvm/versions/node/v18.14.0/lib/node_modules/clinic/node_modules/@clinic/doctor/index.js:139:13)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
sjahns commented 1 year ago

Sorry for the delay

https://github.com/sjahns/clinic-test

I just created an empty nuxt project and tried to use clinic doctor. Same result, as in empty result.

This is Nuxt 2.17 though.

AminAzGol commented 10 months ago

same issue, after ctrl+c got error

Error: process exited by signal SIGABRT
    at ChildProcess.<anonymous> (/Users/xxx/.nvm/versions/node/v18.14.0/lib/node_modules/clinic/node_modules/@clinic/doctor/index.js:139:13)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)

I'm having this issue by running any app with clinic doctor. tried it with NestJs and NodeJs. Even I get it while running the official sample.


sudo clinic doctor --on-port 'autocannon localhost:$PORT' -- node slow-event-loop