-
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
Prioritize rate with tag of VM when selecting from more rates #12534
Prioritize rate with tag of VM when selecting from more rates #12534
Conversation
a7675f8
to
fa94d5f
Compare
3a24bc7
to
af2046a
Compare
@miq-bot remove_label wip |
cc @sergio-ocon |
Do we know which user is generating the report? |
@@ -61,7 +61,7 @@ def self.build_results_for_report_chargeback(options) | |||
# we need to select ChargebackRates for groups of MetricRollups records | |||
# and rates are selected by first MetricRollup record | |||
metric_rollup_record = metric_rollup_records.first | |||
rates_to_apply = cb.get_rates(metric_rollup_record) | |||
rates_to_apply = cb.uniq_rates(metric_rollup_record, options.try(:tag)) |
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 think we don't need .try(:
here.
This comment however is nitpick and can be ignored.
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
options = Chargeback::ReportOptions.new_from_h({})
has always key :tag or method tag
thanks
Yes.
Which tags do you mean ?
I am not sure if I understand this point. How to select just one ? Which category do you mean ? thanks |
af2046a
to
a3fbc6d
Compare
So the customer was tagging the all the elements for visibility, so everything for customer A was tagged as customer A.... When using one single tag, the report was correct, but visibility not. |
Thanks @sergio-ocon for the detailed description of the problem! |
In the long run, we may want to allow users to define rate-selection-mechanism in the reports editor. Something like: Select rate by:
That is a property of report. -- The assigned rates themselves are function of the |
and also
|
@sergio-ocon thanks but when we will somehow prioritize rates according to user's tags then we have to solve also case for admin user which has visibility to everything. would be one of solutions acceptable for our case ? (selection in report definition) |
@isimluk I believe that in the long run we should change the way rates are selected. Right now they are filtered by tag, but they should be selected based on service (dependent on the user) or resource. Tags could then be used as modifiers (a VM with this tag has a different cost that another with a different tag) That would also allow costs to be accrued at different levels (service, project, tenant, etc), that better reflect the real costs (i.e in the cloud network costs are associated to projects, not VM) |
@sergio-ocon, here is an idea:
In short run, would it be possible to tag given DataStore(s) by different tag?
This solution should work unless
|
I would need to discuss it to understand the implications. Can we run a bluejeans? |
@lpichler @sergio-ocon @isimluk I'm thinking that for a short term solution, we can try to select the rate that has at least one tag that the target VM or Storage has. I think this would work in the case that @sergio-ocon illustrated above. Customer A has everything tagged with "Customer A" So currently, getting rates for a VM tagged with "customer A" will return: If we filter out the storage rates that don't have an "assigned to tag" matching any of the tags on the VM it would eliminate Storage Rate 2. I think this could work. What do you think? I can setup a meeting to discuss... |
<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush. |
Nice description @gtanzillo. I was looking on this suggestion and it can work. Are you OK with it @isimluk @sergio-ocon ? Or do we need meeting for it ? thanks |
a3fbc6d
to
4c7d2fc
Compare
4c7d2fc
to
cf13601
Compare
@gtanzillo @isimluk I implemented suggestion in comment #12534 (comment) - to prioritize tag of VM for selecting rate with this tag. |
65539a1
to
a8e94dd
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.
Looks great, thanks! 👍
<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush. |
a8e94dd
to
3cfc381
Compare
There is a case that more rates can be selected (for example when storage have more tags) and in this case, values are accumulated together in report. so this first way how to deterministically select just one rate of storage and compute. So when more rates are selected then rate with matching tag of VM is used.
3cfc381
to
06720cd
Compare
Checked commits lpichler/manageiq@e68eba5~...06720cd with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 |
@gtanzillo rebased as this was merged and I changed name of methods sort of and I added other wrapper method called |
👍 Looks good! |
Backported to Euwe via #13556 |
Backported to Darga via #13559 |
There is a case that more rates can be selected
(for example when storage have more tags)
and in this case, values are accumulated together in report.
so this first way how to deterministically select just one rate
of storage and compute.
So when more rates are selected then
rate with matching tag of VM is used.
This is applied only when rates are assigned to any tagged resources and more rates was selected otherwise behavior is same as before.