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

Fix for queue name mismatch for metric collection #4220

Merged
merged 6 commits into from Sep 8, 2015

Conversation

carbonin
Copy link
Member

@carbonin carbonin commented Sep 4, 2015

The message being placed on the queue to kick off metric
collection was using the ems class name to determine the
queue name.
The metric collector workers use a hard-coded value for
the queue name that would not match the ems class.
Added a class method to each ems which pulls the correct
queue name from the worker class when enqueueing a message
for metric collection.

Fixes #4201

The message being placed on the queue to kick off metric
collection was using the ems class name to determine the
queue name.
The metric collector workers use a hard-coded value for
the queue name that would not match the ems class.
Added a class method to each ems which pulls the correct
queue name from the worker class when enqueueing a message
for metric collection.

Fixes ManageIQ#4201
@@ -16,7 +16,7 @@ def queue_name_for_metrics_collection
raise "Unsupported type #{self.class.name} (id: #{id})"
end

ems.class.name[3..-1].underscore
ems.class.metrics_collect_queue_name
Copy link
Member

Choose a reason for hiding this comment

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

you may want to have EMS have an instance method that calls the class method, so that the caller has ems.metrics_collect_queue_name

Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

Choose a reason for hiding this comment

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

👍

@miq-bot
Copy link
Member

miq-bot commented Sep 4, 2015

Checked commit carbonin@cd0893a with ruby 1.9.3, rubocop 0.33.0, and haml-lint 0.13.0
11 files checked, 0 offenses detected
Everything looks good. 👍

@jvlcek
Copy link
Member

jvlcek commented Sep 4, 2015

LGTM 👍

@@ -40,6 +40,10 @@ def self.default_blacklisted_event_names
)
end

def self.metrics_collect_queue_name
MetricsCollectorWorker.default_queue_name
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather see this pushed up to ManageIQ::Providers::BaseManager (and renamed to metrics_collector_queue_name).

class BaseManager
  def self.metrics_collector_queue_name
    self::MetricsCollectorWorker.default_queue_name
  end
end

Then, this is only needed in one place and all of the CloudManagers and InfraManagers and OtherManagers will get it for free.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will that cause any issues with providers that inherit from ManageIQ::Providers::BaseManager but don't have a self::MetricsCollectorWorker? The only one I could find right now is ManageIQ::Providers::Microsoft::InfraManager

Copy link
Member Author

Choose a reason for hiding this comment

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

As the code is right now it shouldn't get called for those providers, but we will be opening up a method that we know will always fail.

Copy link
Member

Choose a reason for hiding this comment

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

I tried this locally in rails console and ManageIQ::Providers::Microsoft::InfraManager.metrics_collector_queue_name just returns nil.

I think that's safe. Otherwise, we could have the impl in the base MetricsCollectorWorker return empty string instead to avoid NPEs.

Copy link
Member

Choose a reason for hiding this comment

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

👍 On Greg's suggestion

Copy link
Member

Choose a reason for hiding this comment

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

@carbonin OK not pretty but we could reconsider the idea we had of:

if ems.respond_to?(:metrics_collector_queue_name)
  ems.metrics_collect_queue_name
else
  ems.class.name[3..-1].underscore
end

@blomquisg
Copy link
Member

This is a good find! 👍

Couple suggestions above.

@gtanzillo
Copy link
Member

Nice job getting this fixed! 👏

@jvlcek
Copy link
Member

jvlcek commented Sep 8, 2015

👍

1 similar comment
@gtanzillo
Copy link
Member

👍

gtanzillo added a commit that referenced this pull request Sep 8, 2015
Fix for queue name mismatch for metric collection
@gtanzillo gtanzillo merged commit 4dab9e4 into ManageIQ:master Sep 8, 2015
@chessbyte chessbyte added this to the Sprint 29 Ending Sept 14, 2015 milestone Sep 8, 2015
@carbonin carbonin deleted the fix_metrics_collect_queue_name branch September 11, 2015 18:01
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.

None yet

6 participants