-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add additional graphs to the HTML report #394
Add additional graphs to the HTML report #394
Conversation
e06ea92
to
8821e12
Compare
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.
This is wonderful to see! I'm looking forward to getting this merged once my comments are addressed. There also seems to be a bug in the generation of the graph during startup, when startup is >=20 seconds (more or less):
I also would prefer to see the graphs mixed in with the relevant data, and graph first data next. So, show the requests per second graph, then show the requests break down, etc.
src/metrics.rs
Outdated
for set in self.task_sets.iter() { | ||
tasks += set.tasks.len(); | ||
} | ||
self.metrics.record_users_tasks_per_second(tasks as u32); |
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.
Why do we calculate this before merging in the received statistics? Shouldn't we merge statistics and then count?
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.
Also, why does this happen here, instead of in the same place as where we record the other metrics for the graphs?
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.
Why do we calculate this before merging in the received statistics? Shouldn't we merge statistics and then count?
I don't think this would change anything. This is simply counting tasks and users at this point and I don't think other stats would influence that.
Also, why does this happen here, instead of in the same place as where we record the other metrics for the graphs?
Because number of tasks do not need to be recorded for every request that we are collecting stats for; we need to do it just once.
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.
This still feels like an illogical place to perform this function, especially if we don't actually care whether or not we receive the metrics (the purpose of this function).
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.
Agreed. Moved it to GooseAttack::sync_metrics()
. Will that work?
e948168
to
5e96220
Compare
02cee74
to
66e5e53
Compare
b157f45
to
fa52a52
Compare
…here was an error.
fa52a52
to
d944a5d
Compare
…e request with the GooseRequestMetric.
src/metrics.rs
Outdated
expand_per_second_metric_array(&mut self.users_per_second, second, 0); | ||
let last_user_count = match self.users_per_second.last() { | ||
Some(last) => *last, | ||
None => 0, | ||
}; | ||
expand_per_second_metric_array(&mut self.users_per_second, second, last_user_count); | ||
self.users_per_second[second] = self.users; | ||
|
||
expand_per_second_metric_array(&mut self.tasks_per_second, second, 0); | ||
let last_task_count = match self.tasks_per_second.last() { | ||
Some(last) => *last, | ||
None => 0, | ||
}; | ||
expand_per_second_metric_array(&mut self.tasks_per_second, second, last_task_count); |
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.
Users and tasks metric are not tied to a specific request so we still need to rely on Utc:now()
. But this is OK since we will hit this immediately after a new user was spawned so the data should be accurate. The only thing we need to make sure is to carry the last count over the seconds we missed while the thread was sleeping to avoid gaps on the graph.
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.
Tasks metrics has thread_user.started.elapsed().as_millis(),
which is what is in the logs and is already accurate, why can't we use that?
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.
And for users, why can't we also use thread_user.started
?
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 used GooseTaskMetric.elapsed
, which also required me to move this code into receive_metric()
again. But this time it is in the place where task metrics are received, so I think that it makes more sense.
…h second on the graph request goes in.
22fb7ac
to
70500a0
Compare
…r users/tasks per second.
…f tasks that were executed each second.
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.
This is fantastic! A couple small nits (in particular a style change that creates a lot of noise) then it's ready to merge. Very useful addition, thanks again!
src/report.rs
Outdated
|
||
/// Helper function to build HTML charts powered by the | ||
/// [ECharts](https://echarts.apache.org) library. | ||
#[allow(clippy::too_many_arguments)] |
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 always aim to restructure how I call the function instead of selectively ignoring Clippy. Perhaps we can create an object to pass in, for example?
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.
Makes sense. Done.
I ended up moving the function that generates markup onto the struct as well. This looks much nicer to me now.
96bd5c7
to
9a45ab3
Compare
9a45ab3
to
9a2f685
Compare
@@ -2308,6 +2399,9 @@ impl GooseAttack { | |||
} | |||
} | |||
|
|||
// Record current users for users per second graph in HTML report. | |||
self.metrics.record_users_per_second(); |
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 still think this should be moved down to after we receive metrics, as otherwise we may not record a user until later than we should? It can be addressed in a follow, or let's talk through why this isn't relevant.
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.
One small issue I'd like to talk through and address in a followup if it makes sense after we talk it through. Yay, merging!
Closes #246.
Graphs
Screenshots
Errors
Response time
Active users