-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ def initialize(target, start_time, end_time, interval) | |
@end_time = end_time | ||
@interval = interval | ||
@tenant = target.try(:container_project).try(:name) || '_system' | ||
@ext_management_system = @target.ext_management_system | ||
@ext_management_system = @target.ext_management_system || @target.try(:old_ext_management_system) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
@ts_values = Hash.new { |h, k| h[k] = {} } | ||
@metrics = [] | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,10 @@ def perf_capture_object | |
def queue_name_for_metrics_collection | ||
ems = if self.kind_of?(ExtManagementSystem) | ||
self | ||
elsif self.respond_to?(:ext_management_system) | ||
elsif respond_to?(:ext_management_system) && ext_management_system.present? | ||
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 commentThe 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 commentThe 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 |
||
end | ||
raise _("Unsupported type %{name} (id: %{number})") % {:name => self.class.name, :number => id} if ems.nil? | ||
ems.metrics_collector_queue_name | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module ArchivedMixin | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
belongs_to :old_ext_management_system, :foreign_key => :old_ems_id, :class_name => 'ExtManagementSystem' | ||
end | ||
|
||
def archived? | ||
ems_id.nil? | ||
end | ||
|
||
# Needed for metrics | ||
def my_zone | ||
if ext_management_system.present? | ||
ext_management_system.my_zone | ||
elsif old_ext_management_system.present? | ||
# Archived container entities need to retain their zone for metric collection | ||
# This makes the association more complex and might need a performance fix | ||
old_ext_management_system.my_zone | ||
end | ||
end | ||
end |
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?