-
Notifications
You must be signed in to change notification settings - Fork 899
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
Charge for container limits in ChargebackContainerImage #15616
Conversation
@zeari Cannot apply the following label because they are not recognized: compute/containers |
@miq-bot add_label providers/containers |
@zeari WRT the first screenshot it seems that we want to reuse the already present "Allocated CPU Count" and "Allocated Memory" rate fields (instead of adding the new "Limit" ones). |
@@ -22,6 +22,10 @@ def avg(metric) | |||
metric_sum / consumed_hours_in_interval | |||
end | |||
|
|||
def limit_value(metric) | |||
resource.try("limit_" + metric) |
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.
will the report be failing if there will be nil
?
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, nil would just be counted as zero
fd0e8e5
to
bd5935f
Compare
bd5935f
to
c4e7a13
Compare
@lpichler Please re-review. Instead of adding new columns for container limits, I leverage the @simon3z @Loicavenel Notice this charges for allocated resources only when a metric for a time period is available. |
So fixed compute works this way and having just allocated costs work the other way is a bad idea. @miq-bot remove_label wip |
788ac81
to
d1723a3
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.
@zeari you are adding allocated metrics(limits) for memory and CPU.
we added method_for_allocated_metrics
for changing a way how allocated metrics are calculated.
So I am ok with using this for those reasons.
Am I right that all allocated metrics for container comes from current state?
the only what I am suggesting is to change terminology
some thing like 'current_value',... method for allocated could be called current_value
.
Also we have this option in UI in filter tab ManageIQ/manageiq-ui-classic#1738. So I think we need to remove it for the container.
thanks!
d1723a3
to
ae58c26
Compare
app/models/chargeable_field.rb
Outdated
return consumption.send(options.method_for_allocated_metrics, metric) if allocated? | ||
return consumption.avg(metric) if used? | ||
return 0 if consumption.none?(metric) |
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.
@lpichler im not sure if i should remove this line entirely. consumption.none?(metric)
could be true for a container for one of the allocated fields while the actual field is calculated differently through current_value
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.
👍
app/models/container.rb
Outdated
@@ -24,6 +24,8 @@ class Container < ApplicationRecord | |||
include EventMixin | |||
include Metric::CiMixin | |||
|
|||
delegate :created_on, :to => :container_group | |||
|
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 solved a CB bug. I can move this to a different PR.
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.
cc @simon3z
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.
@zeari it would be preferable to have this in another PR, easier to track and merge (hopefully?).
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.
sure
f560d2e
to
e55995f
Compare
429f2eb
to
f1e0252
Compare
f1e0252
to
dcb23a5
Compare
a5ea21c
to
ebfdb2f
Compare
The new 'allocated cores' rate detail should be in the |
@zeari they run rake db:migrate |
This pull request is not mergeable. Please rebase and repush. |
ebfdb2f
to
931f6e7
Compare
931f6e7
to
8efa95e
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.
This pull request is not mergeable. Please rebase and repush. |
8efa95e
to
ca938a0
Compare
ca938a0
to
82305c7
Compare
82305c7
to
9767bea
Compare
Checked commit zeari@9767bea with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0 spec/factories/chargeback_rate_detail.rb
|
@gtanzillo @lpichler please merge |
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.
@blomquisg re-approved
BZ:https://bugzilla.redhat.com/show_bug.cgi?id=1452799
Charge for container cpu and memory limits as the allocated cpu and memory in chargeback reports.
This makes the allocated columns available for "Chargeback for container images" reports.
@lpichler Please review
cc @simon3z
@miq-bot add_label wip, compute/containers