-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor and Query Discovery Mode #21
Conversation
This commit adds the ability to read a list of hosts from mysql_servers table instead of a single host from config file. This merges the old server.rs into the hosts file. This also remove the Pooled connection to a single connection. Fixes: #5
- Refactor the code to make it more readable and maintainable. Added a new module `proxysql` to handle all the proxysql related functionalities. - Refactor the code to use the `query` module to handle all the query discovery related functionalities. - Added Query Discovery configuration. Now users can specify the query discovery mode in the configuration file. The set of rules to discover the queries are defined in the README.md file. Closes: #6
ee1c7f9
to
c114b91
Compare
146ac42
to
2fe8762
Compare
2fe8762
to
b9a2ba4
Compare
/// A boolean indicating if the rule was added successfully. | ||
pub fn add_as_query_rule(&mut self, query: &Query) -> Result<bool, mysql::Error> { | ||
let datetime_now: DateTime<Local> = Local::now(); | ||
let date_formatted = datetime_now.format("%Y-%m-%d %H:%M:%S"); |
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.
Do we also need to write the time zone here?
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 need to complicate here. This will always be run on the same ProxySQL server, so no timezone diff.
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'm only bringing this up because I see we're decoding some time zone below with %z. That seems okay?
b9a2ba4
to
962db6c
Compare
.trim(); | ||
let datetime_mirror_str = format!("{} {}", datetime_mirror_str, tz); | ||
let datetime_mirror_rule = | ||
DateTime::parse_from_str(datetime_mirror_str.as_str(), "%Y-%m-%d %H:%M:%S %z") |
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 the time zone decoding line I'm talking about.
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.
ah, ok - parse_from_str
requires a TZ and we use localTZ.
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.
Ah I see. I missed the part where we append the time zone to the string after we fetch it from ProxySQL.
/// A boolean indicating if the rule was added successfully. | ||
pub fn add_as_query_rule(&mut self, query: &Query) -> Result<bool, mysql::Error> { | ||
let datetime_now: DateTime<Local> = Local::now(); | ||
let date_formatted = datetime_now.format("%Y-%m-%d %H:%M:%S"); |
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'm only bringing this up because I see we're decoding some time zone below with %z. That seems okay?
Fixed review comments in hosts and proxysql.cnf files. Added measure unit to README.md to clarify the values are measured by proxysql using microseconds.
962db6c
to
f451645
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.
Thanks!
Refactor the code to make it more readable and maintainable. Added
a new module
proxysql
to handle all the proxysql relatedfunctionalities.
Refactor the code to use the
query
module to handle all thequery discovery related functionalities.
Added Query Discovery configuration. Now users can specify the
query discovery mode in the configuration file. The set of rules
to discover the queries are defined in the README.md file.