-
-
Notifications
You must be signed in to change notification settings - Fork 335
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 statistics. Move client stats from Monitor to EventManager #2940
Conversation
It's fine now. |
the rest looks good |
Since your PR involved a lot of changes, can you described briefly what you changed in MIGRATION.md?
Also,
Why start_time is a problem here? You can just add start_time to every class right? Every class has to impl Monitor so people won't forget adding that field |
@tokatoka I'll update MIGRATIONS asap. As for start_time, I don't know why it is maintained by each Monitors individually. Does it exist only for calculating and displaying some statistics? If so, I could move it to |
Follow up discussions in #2927.
At top of the description, I want to emphasize that, although this PR involves many lines, I do not add, change or delete any user-aware features. Only code refactor and performance optimize.
Previously, the statistics shown by monitors, including exec_per_secs, etc., are called client stats. All client stats are maintained by monitor. This is not ideal, since monitors should be something to display the stats, not to maintain the stats. As a consequence, there are lots of boilerplates across different Monitor's implementations, and is hard for extension.
In this PR, there are following changes:
statistics
.monitors
module are only something related to display. Thanks for this change, themonitors/mod.rs
finally looks fresh to me.Monitor
s to fields ofEventManager
. Since monitors are always invoked from eventmanager, users don't need change anything.Aggregator
, which is used for aggregate user stats, is merged toClientStatsManager
, a manager used to manage all statistics. As a result, all monitors can access the aggregated information easily.introspection_monitor
is renamed tointrospection_stats
, and the perf-related structures are renamed accordingly.Future possibility:
base
-pattern, as long as we figure out how to deal with thestart_time
.key.clone()
of user stats across the crate. For now, it is hard since we have llmp.I hope this PR is kept as code refactoring, any feature modification could be added in followed PRs.
Feel free to put any questions :)