mcollina / autocannon

fast HTTP/1.1 benchmarking tool written in Node.js
MIT License
7.83k stars 325 forks source link

How I can see error messages #137

Closed nairihar closed 4 years ago

nairihar commented 6 years ago

Running 10s test @ http://localhost:3000 2000 connections

Stat Avg Stdev Max
Latency (ms) 70.3 180.7 3162.21 Req/Sec 37394.86 11981.67 51351
Bytes/Sec 7.45 MB 2.41 MB 10.2 MB

262k requests in 11s, 51.8 MB read 2k errors (0 timeouts)


Output shows I have 2k errors, I have checked nginx logs, I not see any errors. How I can understand that point ?

mcollina commented 6 years ago

I don't think you can using the command line. You can using the JS API. Maybe would you like to send a PR to add switch to display them?

nairihar commented 6 years ago

ok thanks, If I will look source code than I will send PR

mzavaletavargas commented 5 years ago

Hello! Any update on this?

kyegupov commented 4 years ago

@mcollina you said "You can using the JS API." - can you perhaps divulge how exactly would one do that via the JS API?

mcollina commented 4 years ago

You need to listen to the reqError event in https://github.com/mcollina/autocannon#autocannon-events.

mcollina commented 4 years ago

Note that his is likely implemented in https://github.com/mcollina/autocannon/pull/217.

LRagji commented 1 year ago
const instance = autocannon();
instance.addListener("reqError", (err) => {
    console.log(err);
})
instance.addListener("error", (err) => {
    console.log(err);
})

Does this look right? @mcollina cause its not printing anything even though i see 3 errors

amroczeK commented 3 months ago

217

It should be instance.on("reqError", console.error).

Example output:

Error: request timed out
    at Client.onTimeout (/xxx/node_modules/autocannon/lib/run.js:269:21)
    at Client.emit (node:events:519:28)
    at Client.emit (node:domain:488:12)
    at handleTimeout (/xxx/node_modules/autocannon/lib/httpClient.js:63:12)
    at Timeout.Retimer._timerWrapper [as _onTimeout] (/xxx/node_modules/retimer/retimer.js:21:18)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)
Error: request timed out
LRagji commented 3 months ago

@amroczeK isn't addListner and on alias methods..?

https://stackoverflow.com/questions/54557718/what-is-the-difference-between-on-and-addlistener-in-node-js-events

amroczeK commented 3 months ago

@amroczeK isn't addListner and on alias methods..?

https://stackoverflow.com/questions/54557718/what-is-the-difference-between-on-and-addlistener-in-node-js-events

I just tried instance.addListener("reqError"...) and it worked fine, but it's also been a long time since your original comment and now, so probably already fixed if there was an issue. Either usage works fine.