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

Collect metrics for archived containers #13686

Merged
merged 1 commit into from
Feb 24, 2017

Conversation

zeari
Copy link

@zeari zeari commented Jan 29, 2017

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

@zeari zeari force-pushed the cpature_dead_containers branch from cb698b3 to 4a718c1 Compare January 29, 2017 12:08
@yaacov
Copy link
Member

yaacov commented Jan 29, 2017

LGTM 👍 (except for the extra selfs)

@zeari
Copy link
Author

zeari commented Jan 29, 2017

@miq-bot add_label providers/containers, metrics

@simon3z
Copy link
Contributor

simon3z commented Jan 30, 2017

@kbrock it seems that this is related to a change introduced in PR #9448, can you review?

@simon3z
Copy link
Contributor

simon3z commented Jan 31, 2017

@zeari can you add tests?

@zeari zeari force-pushed the cpature_dead_containers branch from 4a718c1 to c06e7ad Compare February 2, 2017 12:52
@simon3z
Copy link
Contributor

simon3z commented Feb 2, 2017

LGTM 👍

@kbrock can you review? (This is touching an area that you've touched "recently")
cc @Fryguy

@@ -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
Copy link
Contributor

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?

Copy link
Author

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?

@zeari zeari force-pushed the cpature_dead_containers branch 2 times, most recently from 96624ef to 9679e36 Compare February 2, 2017 13:36
@zeari
Copy link
Author

zeari commented Feb 2, 2017

@simon3z Do we want similar changes for other archivable container entities?
Im a little unsure the other entities need this.

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.

👍 Looks good to me

@simon3z
Copy link
Contributor

simon3z commented Feb 2, 2017

@simon3z Do we want similar changes for other archivable container entities?
Im a little unsure the other entities need this.

@zeari yes please let's keep them here in this PR.

@zeari zeari force-pushed the cpature_dead_containers branch 2 times, most recently from 3731e18 to 2d1ca6d Compare February 2, 2017 16:09
@zeari
Copy link
Author

zeari commented Feb 2, 2017

@simon3z Added tests and made changes to other archivable container entities

@@ -51,4 +49,13 @@ def disconnect_inv
self.ems_id = nil
save
end

# Needed for metrics
def my_zone
Copy link
Contributor

@simon3z simon3z Feb 2, 2017

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.

@zeari zeari force-pushed the cpature_dead_containers branch from 2d1ca6d to 4516e90 Compare February 2, 2017 17:01
@zeari
Copy link
Author

zeari commented Feb 2, 2017

@zeari this seems duplicated code (on all the other entities) that may deserve a mixin or something.

@simon3z Moved to a mixin

@zeari zeari force-pushed the cpature_dead_containers branch 2 times, most recently from 8cde61c to 5995829 Compare February 2, 2017 17:21
@simon3z
Copy link
Contributor

simon3z commented Feb 2, 2017

@simon3z Moved to a mixin

Thanks @zeari !
LGTM 👍

@Fryguy assigning this to you for now (final review/merge), still waiting for feedback from @kbrock

@miq-bot add_label bug, euwe/yes
@miq-bot assign Fryguy


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'
Copy link
Contributor

Choose a reason for hiding this comment

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

@zeari @Fryguy should this belong to the mixin as well? (Is it even possible? Does it make sense? ...I am asking because I see that the mixing depends on it and it's repeated in all the classes).

Copy link
Member

Choose a reason for hiding this comment

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

Feels like it, yes

@kbrock
Copy link
Member

kbrock commented Feb 17, 2017

Do other models have the same zone issue for archived vms?
A little curious how other vendors work find when an ems => nil

@zeari zeari force-pushed the cpature_dead_containers branch from b7c8880 to 08bb967 Compare February 22, 2017 09:54
@zeari
Copy link
Author

zeari commented Feb 22, 2017

Do other models have the same zone issue for archived vms?
A little curious how other vendors work find when an ems => nil

@kbrock
from https://github.com/ManageIQ/manageiq/blob/master/app/models/vm_or_template.rb#L882 :

 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

@kbrock
Copy link
Member

kbrock commented Feb 22, 2017

@zeari yes, getting the zone from the old ems is probably more correct.
But not sure why containers should work differently than other providers.

@Fryguy Maybe this should be the same for all providers?

@zeari zeari force-pushed the cpature_dead_containers branch 3 times, most recently from ca75e81 to 8d2ef23 Compare February 22, 2017 15:30
@Fryguy
Copy link
Member

Fryguy commented Feb 22, 2017

Maybe this should be the same for all providers?

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.

@@ -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"
Copy link
Member

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?

Copy link
Author

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)

Copy link
Author

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
Copy link
Member

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?

Copy link
Author

@zeari zeari Feb 22, 2017

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

@zeari zeari force-pushed the cpature_dead_containers branch from 8d2ef23 to 4ad0054 Compare February 22, 2017 21:06
@miq-bot
Copy link
Member

miq-bot commented Feb 22, 2017

Checked commit zeari@4ad0054 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
8 files checked, 0 offenses detected
Everything looks good. 🍰

@zeari
Copy link
Author

zeari commented Feb 22, 2017

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.

@Fryguy Changed to ArchivedMixin.
Changing vm_or_template to work with the mixin needs a little more consideration. Can we open an issue for it and deal with it separately?

miq-bot
miq-bot previously approved these changes Feb 24, 2017
@miq-bot miq-bot dismissed their stale review February 24, 2017 14:13

Because @Fryguy did the bot thing again

@Fryguy Fryguy merged commit 5c98cf7 into ManageIQ:master Feb 24, 2017
@Fryguy Fryguy added this to the Sprint 55 Ending Feb 27, 2017 milestone Feb 24, 2017
jrafanie pushed a commit to jrafanie/manageiq that referenced this pull request Feb 24, 2017
@jrafanie
Copy link
Member

Euwe backport is #14065

@simaishi
Copy link
Contributor

Backported to Euwe via #14065

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.

9 participants