Skip to content
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

Rate selection using union of all tags in reporting(consumption) period #15888

Merged
merged 5 commits into from
Sep 12, 2017

Conversation

lpichler
Copy link
Contributor

@lpichler lpichler commented Aug 24, 2017

pulled out from #15857

Issue:

Metric rollups are grouped to so called consumption. we are charging and selection rates regard to consumption. Tags to determine which rates should be selected were taken from first metric rollup
of consumption but it is possible that this rollup don't have tags yet and it was causing the issue.

Solution:

Fix is about taking tags from whole consumption period.

@gtanzillo I did small changes on your code and I added and fix specs. Thanks!

@miq-bot assign @gtanzillo

@miq-bot add_label chargeback, bug

@lpichler lpichler changed the title [WIP] Rate selection using union of all tags in reporting period [WIP] Rate selection using union of all tags in reporting(consumption) period Aug 24, 2017
@miq-bot miq-bot added the wip label Aug 24, 2017
@lpichler lpichler force-pushed the chargeback-all-tags-in-period branch from 53b51b7 to 9d22a4f Compare August 24, 2017 10:26
@lpichler lpichler changed the title [WIP] Rate selection using union of all tags in reporting(consumption) period Rate selection using union of all tags in reporting(consumption) period Aug 24, 2017
Previously, tag list was determined from first metric rollup
of the period but it is not enough to use tag list only from
first rollup and tag list can be changed during period.

Now we are using tag list from metric rollup records of
consumption period.

Source:
ManageIQ#15857
selection of assignments of rates depend on
tags and parents from consumption.
We store those rates to the hash and hash
is indexed by tags and parents (this is
basically hash_features_affecting_rate)

This change is about that we are taking tags
from whole period instead of only first metric rollup.

Taken from
https://github.com/ManageIQ/manageiq/pull/15857/files#diff-38b8d2b191409f1f9bee0b0b0be19e4eR34
but I added check whether tag_names are nil
and uniq method has been replaced by
OR operator:
memo |= rollup.tag_names.split('|')
and there is used inject to eliminate two
cycles (one would be for select of non-nil tag_names and second for map)
simulate that first metric rollup has tag_names=nil
as we are using one metric_rollup and changing it to get then we need to refresh
instance variables of consumption
@miq-bot miq-bot removed the wip label Aug 24, 2017
@lpichler lpichler force-pushed the chargeback-all-tags-in-period branch from 9d22a4f to 7b602ea Compare August 24, 2017 11:38
@miq-bot
Copy link
Member

miq-bot commented Aug 24, 2017

Checked commits lpichler/manageiq@9b9cba0~...7b602ea with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
5 files checked, 0 offenses detected
Everything looks fine. ⭐

@abellotti abellotti modified the milestone: Sprint 68 Ending Sep 4, 2017 Aug 24, 2017
Copy link
Member

@gtanzillo gtanzillo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

@gtanzillo gtanzillo added this to the Sprint 69 Ending Sep 18, 2017 milestone Sep 12, 2017
@gtanzillo gtanzillo merged commit e5ea3ef into ManageIQ:master Sep 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants