-
Notifications
You must be signed in to change notification settings - Fork 898
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
Add faster MiqReportResult helper methods for viewing saved report results #17590
Add faster MiqReportResult helper methods for viewing saved report results #17590
Conversation
These are new methods added in: ManageIQ/manageiq#17590 And are for more efficient for the use cases of ChargebackController and ReportController::SavedReports.
app/models/miq_report_result.rb
Outdated
# Use this method over `report_results` if you don't plan on using the | ||
# `binary_blob` associated with the MiqReportResult (chances are you don't | ||
# need it). | ||
def has_report? |
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 like the cop suggestion of report?
What do you think ?
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.
Honestly, I was thinking about this and want to make this "more verbose". report?
, and even has_report?
gives the impression that report
is a relation, not a column on this report. I am almost thinking of renaming this to valid_report_column?
or something like that.
Thoughts?
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.
hmm, good point... why would report not be a MiqReport
? It seems like the report result might be useless without a report object... but I'm not sure how it's used if there isn't a report. Maybe linked_report?
since the UI use case you changed is to change the selected node in the chargeback tree for the report corresponding to this report result.
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.
Again, this is a serialized report shoved into the report
column, so it could be serialized to anything technically speaking.
linked_report?
to me still sounds like we are talking about a relation, when in fact, this is part of the record itself. Does that rational make sense?
Kicked travis. Other than the method naming, I'm good with these changes. |
@NickLaMuro you might want to put the bz link in the commits so the bz becomes self documenting when the commits get merged and copied to the bz automagically by the bot. I document my commits as if they are going directly to the BZ so testing/recreation steps are all there. |
Yeah, that makes sense I guess. Will do. |
e567768
to
b321ff5
Compare
https://bugzilla.redhat.com/show_bug.cgi?id=1590908 These are new methods added in: ManageIQ/manageiq#17590 And are for more efficient for the use cases of ChargebackController and ReportController::SavedReports.
@NickLaMuro any idea why this is failing the chargeback tests? Are they calling these new methods??? |
@jrafanie Unsure, but when I looked, it seemed like the test failures were benign and unrelated. I will look again though, just to be sure. |
https://bugzilla.redhat.com/show_bug.cgi?id=1590908 A quicker check than having to use `MiqReportResult#report_results`, since binary_blob doesn't need to be loaded into memory. On top of that, generally the binary_blob.data isn't even used in the controller at the end of the day, and this version of the MiqReport record ends up being what is used when generating the page for viewing.
b321ff5
to
b8293ff
Compare
https://bugzilla.redhat.com/show_bug.cgi?id=1590908 Like `MiqReportResult#has_report?`, this is a faster version of checking if the report_result has rows. Like `MiqReport#contains_records?`, this will check against the `extras` attribute on the deserialized version of the `report` column, but instead of using the `table` value (which is not saved into the `report` column), just do a light SQL existence check on the `html_details` to confirm there are generated rows for this report. The SQL query most likely won't be needed, and it is super light weight, only returning a single digit, or an empty result set if there are no records.
b8293ff
to
3a26db0
Compare
Checked commits NickLaMuro/manageiq@6b2e57d~...3a26db0 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@NickLaMuro can you add labels to match the other one for the bz? |
@miq-bot blocker, gaprindashvili/yes |
@NickLaMuro unrecognized command 'blocker', ignoring... Accepted commands are: add_label, add_reviewer, assign, close_issue, move_issue, remove_label, rm_label, set_milestone |
... @miq-bot add_label blocker, gaprindashvili/yes |
https://bugzilla.redhat.com/show_bug.cgi?id=1590908 These are new methods added in: ManageIQ/manageiq#17590 And are for more efficient for the use cases of ChargebackController and ReportController::SavedReports.
https://bugzilla.redhat.com/show_bug.cgi?id=1590908 These are new methods added in: ManageIQ/manageiq#17590 And are for more efficient for the use cases of ChargebackController and ReportController::SavedReports.
https://bugzilla.redhat.com/show_bug.cgi?id=1590908 These are new methods added in: ManageIQ/manageiq#17590 And are far more efficient for the use cases of ChargebackController and ReportController::SavedReports.
@miq-bot add_label fine/yes |
Add faster MiqReportResult helper methods for viewing saved report results (cherry picked from commit dbf6596) https://bugzilla.redhat.com/show_bug.cgi?id=1594387
Fine backport details:
|
Add faster MiqReportResult helper methods for viewing saved report results (cherry picked from commit dbf6596) https://bugzilla.redhat.com/show_bug.cgi?id=1594386
Gaprindashvili backport details:
|
https://bugzilla.redhat.com/show_bug.cgi?id=1590908 These are new methods added in: ManageIQ/manageiq#17590 And are far more efficient for the use cases of ChargebackController and ReportController::SavedReports.
https://bugzilla.redhat.com/show_bug.cgi?id=1594386 Gaprindashvili Backport commit from: ManageIQ#4143 Original SHA: ff7ee24 Rest of original message below... * * * These are new methods added in: ManageIQ/manageiq#17590 And are far more efficient for the use cases of ChargebackController and ReportController::SavedReports.
https://bugzilla.redhat.com/show_bug.cgi?id=1594387 Gaprindashvili Backport commit from: ManageIQ#4143 Original SHA: ff7ee24 Rest of original message below... * * * These are new methods added in: ManageIQ/manageiq#17590 And are far more efficient for the use cases of ChargebackController and ReportController::SavedReports.
…rtResult https://bugzilla.redhat.com/show_bug.cgi?id=1594387 Gaprindashvili Backport commit from: ManageIQ#4143 Original SHA: ff7ee24 Rest of original message below... * * * These are new methods added in: ManageIQ/manageiq#17590 And are far more efficient for the use cases of ChargebackController and ReportController::SavedReports.
…tResult https://bugzilla.redhat.com/show_bug.cgi?id=1594386 Gaprindashvili Backport commit from: ManageIQ#4143 Original SHA: ff7ee24 Rest of original message below... * * * These are new methods added in: ManageIQ/manageiq#17590 And are far more efficient for the use cases of ChargebackController and ReportController::SavedReports.
Adds two methods:
MiqReportResult#has_report?
MiqReportResult#contains_records?
This is specifically used to avoid having to fetch and deserialize the
binary_blob
associated with theMiqReportResult
, which has the entireRuport::Data::Table
object saved in it, and eventually is never used in some of the controllers that make use of them.MiqReportResult#has_report?
A quicker check than having to use
MiqReportResult#report_results
, since binary_blob doesn't need to be loaded into memory. On top of that, generally thebinary_blob.data
isn't even used in the controller at the end of the day, and this version of theMiqReport
record ends up being what is used when generating the page for viewing.MiqReportResult#contains_records?
Like
MiqReportResult#has_report?
, this is a faster version of checking if the report_result has rows.Like
MiqReport#contains_records?
, this will check against theextras
attribute on the deserialized version of thereport
column, but instead of using thetable
value (which is not saved into thereport
column), just do a light SQL existence check on thehtml_details
to confirm there are generated rows for this report.The SQL query most likely won't be needed, and it is super light weight, only returning a single digit, or an empty result set if there are no records.
Links
Will put benchmarks in the associated UI PR.