Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Check metrics authentication validity before perf_capture_queue #493
Check metrics authentication validity before perf_capture_queue #493
Changes from 2 commits
be53bdc
4df0a93
b8a12a9
5e07948
0c258a3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Do all providers implement similar logic? Can we extract this so other providers will also bypass metrics capture with invalid auth?
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 is a "future" PR question... I'm fine with fixing kubernetes in this way now.
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.
It is a little tricky because not all providers have different endpoints and/or authentications so what you need to check varies.
What I've considered doing is consolidating this in the
supports :metrics {}
block in ext_management_system so that the logic could be limited to the provider but that is going to be more of a cross-provider change.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.
updating
supports
to handle all the actual logic totally got me in a few PRs. they are still outstanding :( ✨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.
@kbrock do we have a general way of handling this? When called from
perf_capture_timer
asems.perf_capture_object.perf_capture_all_queue
target
isnil
and onlyems
is setThere 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 really don't like how
@target
is set behind the scenes.perf_capture_gap, perf_capture_all_queue, perf_capture_realtime_queue ( /via ui)
if you are running capture for a whole ems,
target
is null.If you are running capture for a single object,
target
is single object.If you are running capture for a batch/vmware,
target
/targets
is an arrayI think I'd just use
ems
Note: you need to handle multiple targets case. (I would like everyone to have
targets
)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.
Does it make sense to ensure that
prometheus
exists in here? (akacapture_context
)That way verify does all the raises here.
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.
Well when we use this below it is on a single object so this has to work with
target
orems
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.
Yeah I was thinking that but we use the return of
capture_context
and returning something from averify_*
method seems weird.Also building a prometheus_capture_context object seems like overkill when it isn't used in the
perf_capture_timer
case hereThere 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 probably could call this from
capture_context
and raise if that is nil in that methodThere 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.
Okay I pushed a second commit which moves some things around, LMK if you like it better or worse and it is easy to revert out
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.
You know, it doesn't look like it needs to know about target at all beside building a couple of printf strings. Looks good for now.
TANGENT:
Yea, I guess the code is currently coded to reference a single target.
I have on my short list to convert this over to
targets
.For some reason, I can't find the initialize method on
PrometheusCaptureContext
.But from what I can tell, that code assumes a single target when building the labels.
Not sure how hard it would be to handle a list of targets over there.
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.
Do we need to check if the ems is paused?
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 wonder if we should do that up in core perf_capture_timer since that is going to be the same for all providers, good call though. I'm a little wary of that just because it feels like every single queue method would have to implement this check but I don't know that there's a more central place to handle it and this is a real-world problem.
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.
ManageIQ/manageiq#22564
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.
yea. this is nice
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.
TODO why only
@container
and@node
and not@group
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.
NOTE I don't love how this spec sets up these ivars since it makes it difficult to override in sub-contexts. I worked around it but I think I should refactor to use
let
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.
NOTE a good example of why the
before {}
setting up ivars isn't great