These are chat archives for ManageIQ/manageiq/performance

7th
Apr 2016
Keenan Brock
@kbrock
Apr 07 2016 14:36
preloader wants a 'Relation' I have an ActiveRecord.where(:name => 'x') - is there an easy way to convert?
Chris Arcand
@chrisarcand
Apr 07 2016 14:43
Is that not a relation?
Keenan Brock
@kbrock
Apr 07 2016 14:49
ManageIQ/manageiq@387640c
ignores the clause passed in
in https://github.com/ManageIQ/manageiq/blob/2b66dc4d94ca30f816127171b8033fbd9399a029/app/models/metric/rollup.rb#L247 we pass in a where clause saying: please only bring back the most recent performance data
so in the end, we're bring back ALL performance data ever for those records
it is taking 24 minutes
I need to fix preload to allow me to pass a where clause
cool, per @matthewd - add a relation called 'recent_metrics'
(I modified his words - maybe he doesn't like that idea)
Oleg Barenboim
@chessbyte
Apr 07 2016 14:51
@kbrock so you need to enhance ActiveRecord or ManageIQ to pass a where clause?
Matthew Draper
@matthewd
Apr 07 2016 14:52
I was going to suggest that, but that's not going to go so well if it needs to be parameterised
recs = recs.includes(:vim_performance_states).where(:vim_performance_states => { :timestamp => [ts, ..] }) ?
Keenan Brock
@kbrock
Apr 07 2016 14:53
@chessbyte um, active record changed to no longer support something we were using
Matthew Draper
@matthewd
Apr 07 2016 14:53
Oh, is recs actually a relation?
Keenan Brock
@kbrock
Apr 07 2016 14:53
trying to find a way to add a relation (with a where clause) in our models
Oleg Barenboim
@chessbyte
Apr 07 2016 14:54
is there a replacement functionality in AR?
Keenan Brock
@kbrock
Apr 07 2016 14:54
nope
um
Matthew Draper
@matthewd
Apr 07 2016 14:54
Not really; the functionality was never there to begin with
Keenan Brock
@kbrock
Apr 07 2016 14:54
@matthewd ^ ?
lol - but WE found it!
Matthew Draper
@matthewd
Apr 07 2016 14:54
We were only getting it by directly invoking preload through private API
Oleg Barenboim
@chessbyte
Apr 07 2016 14:55
@kbrock this sounds like a BIG deal
Keenan Brock
@kbrock
Apr 07 2016 14:55
@matthewd confirm: trying to pass in preload_scope is probably a long / lost road?
we only use it in 1 place
cap&U
right now, the query is taking ~24 minutes to bring back the data ;)
our timeout is 30 for the task
no cap&U is getting processed
Daniel Berger
@djberg96
Apr 07 2016 14:56
what's the query?
Keenan Brock
@kbrock
Apr 07 2016 14:57
simple one - just "forgot" the where clause
again, I was trying to optimize the query, but the sheer quantity of data coming across the wire. it is as if we said "bring back all stats for all time"
Matthew Draper
@matthewd
Apr 07 2016 14:59
@kbrock dunno… have you ruled out the possibility of it Just Working?
Keenan Brock
@kbrock
Apr 07 2016 14:59
lol
VimPerformanceState Load (1473229.6ms)  SELECT "vim_performance_states".* FROM
a query taking that long isn't "Just Working"
Matthew Draper
@matthewd
Apr 07 2016 15:00
confirm: trying to pass in preload_scope is probably a long / lost road?
Keenan Brock
@kbrock
Apr 07 2016 15:00
aah
@matthewd confused are you saying A) I should try and construct a scope to pass in there? or are you saying B) no, don't bother there, try and create a custom scope and see where that goes?
Matthew Draper
@matthewd
Apr 07 2016 15:02
I was asking whether you'd already tried A
Keenan Brock
@kbrock
Apr 07 2016 15:03
cool
I've tried:
{:vim_performance_states => :timestamp => []}
Matthew Draper
@matthewd
Apr 07 2016 15:04
MiqPreloader.preload(recs, :vim_performance_states, VimPerformanceState.where(:timestamp => [ts, Metric::Helper.nearest_hourly_timestamp(Time.now.utc))) unless recs.empty?
Keenan Brock
@kbrock
Apr 07 2016 15:04
{:timestamp => []}
and arel
hmm, maybe not that
Matthew Draper
@matthewd
Apr 07 2016 15:04
(with the obvious param pass-through change in the preload method)
Keenan Brock
@kbrock
Apr 07 2016 15:04
thnks
Daniel Berger
@djberg96
Apr 07 2016 15:06
kbrock, what does .explain show?
is auto_explain_threshold_in_seconds still an option in 5?
Keenan Brock
@kbrock
Apr 07 2016 15:07
hmm
@matthewd you suck. I was going the arel route
^ that was a thanks. this looks promising
Keenan Brock
@kbrock
Apr 07 2016 15:18
@matthewd I tried arel, hash, so many syntaxes. didn't try AR.where - very good idea
Keenan Brock
@kbrock
Apr 07 2016 17:04
@matthewd testing that fix now - thanks ManageIQ/manageiq#7783