-
Notifications
You must be signed in to change notification settings - Fork 897
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
Collect metrics for archived containers #13686
Conversation
cb698b3
to
4a718c1
Compare
LGTM 👍 (except for the extra selfs) |
@miq-bot add_label providers/containers, metrics |
@zeari can you add tests? |
4a718c1
to
c06e7ad
Compare
@@ -18,9 +19,6 @@ class Container < ApplicationRecord | |||
has_many :metric_rollups, :as => :resource | |||
has_many :vim_performance_states, :as => :resource | |||
|
|||
# Needed for metrics | |||
delegate :my_zone, :to => :ext_management_system |
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 are you sure this is not used anywhere else in the metrics capture execution?
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.
@simon3z why? I added my_zone
as a method further down in this class.
You mean if it should be a virtual_column
or cached somehow?
96624ef
to
9679e36
Compare
@simon3z Do we want similar changes for other archivable container entities? |
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 good to me
3731e18
to
2d1ca6d
Compare
@simon3z Added tests and made changes to other archivable container entities |
app/models/container.rb
Outdated
@@ -51,4 +49,13 @@ def disconnect_inv | |||
self.ems_id = nil | |||
save | |||
end | |||
|
|||
# Needed for metrics | |||
def my_zone |
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 this seems duplicated code (on all the other entities) that may deserve a mixin or something. Anyway it seems to belong to a single place.
2d1ca6d
to
4516e90
Compare
8cde61c
to
5995829
Compare
app/models/container.rb
Outdated
|
||
has_one :container_group, :through => :container_definition | ||
belongs_to :ext_management_system, :foreign_key => :ems_id | ||
belongs_to :old_ext_management_system, :foreign_key => :old_ems_id, :class_name => 'ExtManagementSystem' |
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.
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.
Feels like it, yes
Do other models have the same |
b7c8880
to
08bb967
Compare
@kbrock def my_zone
ems = ext_management_system
ems ? ems.my_zone : MiqServer.my_zone
end I think getting the zone from the old ems is more correct |
ca75e81
to
8d2ef23
Compare
Yes, I was thinking the same thing. I don't like that this is container specific, in particular the name of the mixin implies that it can only be used for containers, which isn't necessarily true. |
app/models/container_group.rb
Outdated
@@ -13,7 +14,6 @@ class ContainerGroup < ApplicationRecord | |||
:through => :container_definitions | |||
has_many :container_definitions, :dependent => :destroy | |||
has_many :container_images, -> { distinct }, :through => :container_definitions | |||
belongs_to :ext_management_system, :foreign_key => "ems_id" |
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.
Why is this being removed?
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.
@Fryguy because im adding it to ContainerArchivedMixin
(also in this 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.
Ah sorry, i thought this was old_ext_management_system
ext_management_system | ||
elsif respond_to?(:old_ext_management_system) && old_ext_management_system.present? | ||
old_ext_management_system |
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 concerns me as queue_name_for_metrics_collection targets which worker will run the collection. If old_ext_management_system points to a no longer enabled EMS, what will happen? Will we just put stuff on the queue that will never get executed?
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 dont think we archive those(@simon3z right?) so from what i understand old_ext_management_system
would either be nil
and get caught by the exception below or be a live ems
and fetch metrics correctly
8d2ef23
to
4ad0054
Compare
Checked commit zeari@4ad0054 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@Fryguy Changed to |
Because @Fryguy did the bot thing again
https://bugzilla.redhat.com/show_bug.cgi?id=1420721 Collect metrics for archived containers (cherry picked from commit 5c98cf7)
Euwe backport is #14065 |
Backported to Euwe via #14065 |
Sometimes a container 'dies' but we still have uncollected metrics for it on the hawkular side which we would like to retrieve.
Has to do with https://bugzilla.redhat.com/show_bug.cgi?id=1408968 but does not solve it.
EDIT: This is the BZ fixed by this PR: https://bugzilla.redhat.com/show_bug.cgi?id=1420721
@moolitayer @yaacov @simon3z Please review