-
Notifications
You must be signed in to change notification settings - Fork 898
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
Extract rates cache to separate class #12608
Conversation
eb1cc0b
to
ed656ce
Compare
This will help us to dispart Chargeback calculations and rates cache.
This will enable us to create more advanced rate selection processes. This will also enable us to cache all the rates in advance
ed656ce
to
72e3dfc
Compare
Checked commits isimluk/manageiq@07cd0ff~...72e3dfc with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 |
@rates ||= {} | ||
@rates[perf.hash_features_affecting_rate] ||= | ||
begin | ||
prefix = tag_prefix(perf) |
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.
@isimluk is this same as
prefix = Chargeback.report_cb_model(self.class.name).underscore
?
We was deriving prefix
from chargeback class, (basically is report for VM, Projects or Contr. ) now you are doing it from perf
record.
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.
Yes, it is the same. 👍
Each Chargeback.descendant
has where_clause
method. This where_class
limits the resource_type of perf records coming here.
LGTM 👍 |
Nice! 👍 |
@miq-bot add_label euwe/yes |
@miq-bot remove_label euwe/no |
@isimluk is there a BZ for this? |
No bz for this. This cannot be backported alone, this pr has dependencies. I created #13419 to get this backported. |
Backported to Euwe via #13419 |
Previously, the
Chargeback
class and its descendants managed relevant ChargebackRates. TheChargeback
class suffers from feature-creep, responsibility-creep. In regards to rates, it caches them, defines assignments and selects rate to define interval.And we have more features coming (1) see #12534, (2) dynamic rates for dynamic disk types. And there is more. In future, chargeback plans for more intelligent Chargeback rate selection and caching. I have heard of rates priorities, etc. That all is better achieved in separate class. Personally, I want the cache to drop the rates that charge for 0 in the future (that will improve performance of the cb calculation itself).
@miq-bot add_label chargeback, refactoring, euwe/no
@miq-bot assign @gtanzillo