-
-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Title json #44
Title json #44
Conversation
You know I'm asking you to add a unit test :) |
I added some assertions, not sure how else I could test that? Are those okay? :) |
requests: histAsObj(requests, totalRequests), | ||
latency: addPercentiles(latencies, histAsObj(latencies)), | ||
throughput: histAsObj(throughput, totalBytes), | ||
errors: errors, | ||
timeouts: timeouts, | ||
duration: Math.round((Date.now() - startTime) / 1000), | ||
start: startTime, | ||
finish: Date.now(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have those as Date objects, rather than as epocs. Easier to print :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Epochs are easier for transmission/serialisation though, right? I'll create them as objects though if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do, those output will very likely be consumed by humans, and Date
do jsonify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start
is still an epoch, you will need to convert it to a Date
object: https://github.com/mcollina/autocannon/blob/master/lib/run.js#L79
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
startTime needs to remain an epoch for the duration calculation, but I use new Date(startTime) to convert back to an object from the epoch. Do you want me to convert startTime to an object and then convert it to an epoch for the duration calculation? it's just two ways of achieving the same thing.
requests: histAsObj(requests, totalRequests), | ||
latency: addPercentiles(latencies, histAsObj(latencies)), | ||
throughput: histAsObj(throughput, totalBytes), | ||
errors: errors, | ||
timeouts: timeouts, | ||
duration: Math.round((Date.now() - startTime) / 1000), | ||
start: new Date(startTime), | ||
finish: new Date(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcollina Here. I'm using new Date(value)
: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I didn't see that. All good for me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, we were still talking on the outdated diff 👍
fixes #43
Also found an issue where the timeout flag was missing.