-
Notifications
You must be signed in to change notification settings - Fork 897
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
Report Widget #14285
Report Widget #14285
Conversation
/cc @NickLaMuro |
app/models/miq_report/generator.rb
Outdated
@@ -97,7 +97,11 @@ def include_as_hash(includes = include, klass = nil) | |||
if klass.nil? | |||
klass = db_class | |||
result = {} | |||
cols.each { |c| result[c.to_sym] = {} if klass.virtual_attribute?(c) } if cols | |||
if cols && respond_to?(:virtual_attribute?) |
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.
Should this be klass.respond_to?(:virtual_attribute?)
It was embedding sql directly into the sql yet requesting the tables be downloaded anyway
Checked commits kbrock/manageiq@4357b8d~...26de928 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
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.
Looks good 👍
@kbrock Please resolve conflict and create an Euwe-specific PR (referencing this one) or suggest other PRs to backport. $ git diff
diff --cc app/models/miq_report/generator.rb
index b118111,f340ead..0000000
--- a/app/models/miq_report/generator.rb
+++ b/app/models/miq_report/generator.rb
@@@ -85,7 -97,11 +85,15 @@@ module MiqReport::Generato
if klass.nil?
klass = db_class
result = {}
++<<<<<<< HEAD
+ cols.each { |c| result.merge!(c.to_sym => {}) if klass.virtual_attribute?(c) || klass == LiveMetric } if cols
++=======
+ if cols && klass.respond_to?(:virtual_attribute?)
+ cols.each do |c|
+ result[c.to_sym] = {} if klass.virtual_attribute?(c) && !klass.attribute_supported_by_sql?(c)
+ end
+ end
++>>>>>>> 832c5a3... Merge pull request #14285 from kbrock/widget_2
end
if includes.kind_of?(Hash)
@@@ -99,12 -115,16 +107,20 @@@
assoc_klass = assoc_reflection.nil? ? nil : (assoc_reflection.options[:polymorphic] ? k : assoc_reflection.klass)
if v.nil? || v["include"].blank?
- result[k] = {}
- elsif assoc_klass
- result[k] = include_as_hash(v["include"], assoc_klass)
+ result.merge!(k => {})
+ else
+ result.merge!(k => get_include_for_find(v["include"], assoc_klass)) if assoc_klass
end
++<<<<<<< HEAD
+ v["columns"].each { |c| result[k].merge!(c.to_sym => {}) if assoc_klass.virtual_attribute?(c) } if assoc_klass && assoc_klass.respond_to?(:virtual_attribute?) && v["columns"]
++=======
+ if assoc_klass && assoc_klass.respond_to?(:virtual_attribute?) && v["columns"]
+ v["columns"].each do |c|
+ result[k][c.to_sym] = {} if assoc_klass.virtual_attribute?(c) && !assoc_klass.attribute_supported_by_sql?(c)
+ end
+ end
++>>>>>>> 832c5a3... Merge pull request #14285 from kbrock/widget_2
end
end
elsif includes.kind_of?(Array) |
Thanks @simaishi - removing euwe label |
Introduced by ManageIQ#14285 Addresses ManageIQ#14393 A null hardware record was returning null provisioned_storage it is now returning 0 This was causing issues for automate
High level
Widgets are reports that are pre-run for users.
They are updated every hour and run in the user's group context and timezone.
In summary, each report is run many times (# groups x # timezones x # times per day).
So any performance issue will be felt.
A customer complained that three reports were taking too long to run.
Before
Vm#provisioned_storage
. This forces a download of thehardwares
anddisks
tables.After
includes
list.Vm#provisioned_storage
is now SQL-friendly so we can take advantage of the aboveincludes
optimization.numbers
comments
* Memory usage does not reflect 7,169,463 freed objects.
* Memory usage does not reflect 2,051,300 freed objects.
GC cleaned up too many objects to truly reflect the memory improvement
related to:
reproduction details
comments
master-1
master-1
master-1
master-1
* Memory usage does not reflect 7,169,463 freed objects.
* Memory usage does not reflect 3,134,060 freed objects.
* Memory usage does not reflect 3,117,013 freed objects.
* Memory usage does not reflect 3,134,141 freed objects.
comments
widget-1
widget-1
widget-1
widget-1
* Memory usage does not reflect 5,280,780 freed objects.
* Memory usage does not reflect 2,010,357 freed objects.
* Memory usage does not reflect 1,838,645 freed objects.
* Memory usage does not reflect 2,051,300 freed objects.