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

Introduce: supports :capture #15194

Merged
merged 2 commits into from
Jun 7, 2017
Merged

Conversation

isimluk
Copy link
Member

@isimluk isimluk commented May 23, 2017

What

Not all providers support metrics :capture. 📊

Currently we cannot tell, so we put perf_capture* into MiqQueue for whatever user has tagged. Putting everything on queue is unfortunate. It kills performance.

Note: This fixes first part of #15193.

Why?

Currently we fail horribly when you tag your scvmm/hyper for C&U capture.

Wait, why did the C&U fail for SCVMM?

It fails at

self.class.parent::MetricsCapture.new(self)
as self.class.parent::MetricsCapture resolves to Microsoft::Infra::MetricsCapture that does not have any methods for scvmm/hyperv (it's just the base Base::MetricCapture).

@@ -1,5 +1,6 @@
module Metric::CiMixin
extend ActiveSupport::Concern
include SupportsFeatureMixin
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.

unless, every module that this mixin includes already has the SupportsFeatureMixin

Copy link
Member Author

Choose a reason for hiding this comment

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

I see, I got away of this include.

Instead, I made sure (in first commit) that everything that includes CiMixin includes the SupportsFeatureMixin as well.

@djberg96
Copy link
Contributor

I already fought this battle and just resorted to timelines:

#13381

@durandom
Copy link
Member

@djberg96 good point
Now that @moolitayer did something based on the :metrics feature in ManageIQ/manageiq-providers-kubernetes#7 I think it makes sense to introduce it

Copy link
Member

@durandom durandom left a comment

Choose a reason for hiding this comment

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

I'm 👍 with it.
@djberg96 @moolitayer any concerns?

@isimluk
Copy link
Member Author

isimluk commented May 24, 2017

@durandom, @lpichler thinks that I could do better than hardcoding scvmm false. So, I come-up with

supports :metrics do
  unless self.class.parent::MetricsCapture.instance_methods.include?(:perf_collect_metrics)
    unsupported_reason_add(:metrics, _('This provider does not support metrics collection'))
  end
end

That works perfect for things that actually run capture.

However, it will not work for ContainerProject, MiqEnterprise, or Zone. That do not capture stuff, they just get metrics_rolups.

So the option is to rename support :metrics to support :capture and have it more fine grained. -> i.e. potentially introduce support :rollups in future if ever needed.

@moolitayer
Copy link

How do you plan to use these? are the metrics collector workers the ones adding perf_capture* ?
Maybe you can incorporate something like https://github.com/ManageIQ/manageiq-providers-kubernetes/pull/7/files (and then I can remove that code)

The distinction between :capture and :metrics makes sense.

@isimluk
Copy link
Member Author

isimluk commented May 24, 2017

@moolitayer I planned to use it like shown at 43bf24a but not starting the capture worker would be even better, I'll look into it.

@miq-bot
Copy link
Member

miq-bot commented Jun 1, 2017

This pull request is not mergeable. Please rebase and repush.

@isimluk
Copy link
Member Author

isimluk commented Jun 5, 2017

@lpichler It's pity you were so demanding. 😿 Now we have merge conflict and the question that is unanswered for 12 days. Soon this will be closed as a stale pr. :-)

@isimluk
Copy link
Member Author

isimluk commented Jun 5, 2017

So, I went with the second solution (and that avoids the conflict)

@@ -1,5 +1,6 @@
class ContainerService < ApplicationRecord
include CustomAttributeMixin
include SupportsFeatureMixin

Choose a reason for hiding this comment

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

I'm not sure why this is here?

As far as I know we should collect metrics on container entities if the associated ext has a metrics endpoint

Copy link
Member Author

Choose a reason for hiding this comment

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

ContainerService include CiMixin that uses SupportsFeatureMixin.

The included do of CiMixin will fail on supports :capture unless the supports means something.

Choose a reason for hiding this comment

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

How come I can't see the include like in the other classes? Is that transitive in some way?

Copy link
Member Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

Oh sorry I missed that (I'm on a mobile device)

Copy link
Member Author

Choose a reason for hiding this comment

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

No problem. I remember I missed that too first time. :-D

@isimluk isimluk changed the title Introduce: supports :metrics Introduce: supports :capture Jun 6, 2017
@miq-bot
Copy link
Member

miq-bot commented Jun 6, 2017

Checked commits isimluk/manageiq@8e7f063~...ec19fba with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
7 files checked, 1 offense detected

app/models/mixins/supports_feature_mixin.rb

  • ❗ - Line 92, Col 5 - Style/AlignHash - Align the elements of a hash literal if they span more than one line.

Copy link

@moolitayer moolitayer left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@durandom durandom left a comment

Choose a reason for hiding this comment

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

Great, thanks @isimluk

@miq-bot assign @agrare

@lpichler
Copy link
Contributor

lpichler commented Jun 7, 2017

@lpichler It's pity you were so demanding. 😿

@isimluk I am sorry 🐱 I learned it from @durandom 😺

but great, thanks!

@agrare agrare merged commit e697fec into ManageIQ:master Jun 7, 2017
@agrare agrare added this to the Sprint 63 Ending Jun 19, 2017 milestone Jun 7, 2017
@isimluk isimluk deleted the supports-metrics branch June 7, 2017 14:12
@djberg96
Copy link
Contributor

djberg96 commented Jun 7, 2017

Should those of us who used timelines previously switch to use this?

@durandom
Copy link
Member

durandom commented Jun 7, 2017

Should those of us who used timelines previously switch to use this?

Not sure. I think metrics, events and timelines are different. Guess this has to be solved from a usage perspective.

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.

8 participants