Skip to content
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

Merged
merged 8 commits into from
Jul 5, 2016
Merged

Title json #44

merged 8 commits into from
Jul 5, 2016

Conversation

GlenTiki
Copy link
Collaborator

@GlenTiki GlenTiki commented Jul 5, 2016

fixes #43

Also found an issue where the timeout flag was missing.

@mcollina
Copy link
Owner

mcollina commented Jul 5, 2016

You know I'm asking you to add a unit test :)

@GlenTiki
Copy link
Collaborator Author

GlenTiki commented Jul 5, 2016

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(),
Copy link
Owner

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 :).

Copy link
Collaborator Author

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.

Copy link
Owner

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Owner

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

Copy link
Collaborator Author

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(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner

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!

Copy link
Collaborator Author

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 👍

@mcollina mcollina merged commit cbd6485 into master Jul 5, 2016
@mcollina mcollina deleted the title-json branch July 5, 2016 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add a --name (or --title) swith
2 participants