Bug 1572350

Summary: [RFE] Allow custom session logging size when generating reports to prevent WARN statements unnecessarily
Product: Red Hat CloudForms Management Engine Reporter: Robb Manes <rmanes>
Component: UI - OPSAssignee: Harpreet Kataria <hkataria>
Status: CLOSED ERRATA QA Contact: Niyaz Akhtar Ansari <nansari>
Severity: low Docs Contact:
Priority: unspecified    
Version: 5.9.0CC: hkataria, lavenel, mpovolny, nansari, obarenbo, rovalent, simaishi
Target Milestone: GAKeywords: FutureFeature
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-02-07 23:01:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Robb Manes 2018-04-26 19:12:04 UTC
Description of problem:
When generating reports of any variety, when it is to be sent to many email addresses, logs appear when the session object exceeds a given size:

[----] W, [2018-04-18T13:51:47.689723 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button): Session object size of 182.9 KB exceeds threshold of 100 KB
[----] W, [2018-04-18T13:51:47.690012 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button): _csrf_token <String> Size 44
[----] W, [2018-04-18T13:51:47.690110 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button): all_sortcol <Fixnum> Size 8
[----] W, [2018-04-18T13:51:47.690229 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button): all_sortdir <String> Size 4
[----] W, [2018-04-18T13:51:47.690308 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button): breadcrumbs <Array> Size 81 Elements 1
[----] W, [2018-04-18T13:51:47.690393 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button): browser <Hash> Size 111 Elements 5
[----] W, [2018-04-18T13:51:47.690459 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button): changed <FalseClass> Size 3
[----] W, [2018-04-18T13:51:47.690537 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button): css <Hash> Size 297 Elements 13
[----] W, [2018-04-18T13:51:47.690607 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button): customer_name <String> Size 4
[----] W, [2018-04-18T13:51:47.696379 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button): edit <Hash> Size 148931 Elements 14
[----] W, [2018-04-18T13:51:47.702474 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button):   cb_cats <Hash> Size 803 Elements 20
[----] W, [2018-04-18T13:51:47.702645 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button):   cb_tenant <Hash> Size 175 Elements 13
[----] W, [2018-04-18T13:51:47.706729 #6028:16fb214]  WARN -- : MIQ(report_controller-x_button):   cb_users <Hash> Size 141488 Elements 2366
- - - - - 8< - - - - - 

This warning is triggered due to a hard-coded statement setting the threshold to 100kb:

  case Rails.env
  when "test", "development"
    SESSION_LOG_THRESHOLD = 50.kilobytes
    SESSION_ELEMENT_THRESHOLD = 5.kilobytes
  else
    SESSION_LOG_THRESHOLD = 100.kilobytes
    SESSION_ELEMENT_THRESHOLD = 10.kilobytes
  end

Customer monitoring utilities sometimes look for WARN statements and, even when this is expected behavior for their teams, they currently have no way to raise the session size thresholds to not WARN.

This RFE was requested so that we can manually configure a threshold.

Version-Release number of selected component (if applicable):
Any version (tested upstream)

How reproducible:
Every time.

Steps to Reproduce:
1. Have multiple email addresses (thousands) in which a report is generated to
2. Generate the report, view the messages in the log.

Actual results:
Warning prints statically at 100kb.

Expected results:
User should have some control over the warn threshold.

Additional info:
PR's are here, to both core repo (for settings) and classic UI:
https://github.com/ManageIQ/manageiq/pull/17334
https://github.com/ManageIQ/manageiq-ui-classic/pull/3831

Comment 3 CFME Bot 2018-04-27 01:46:32 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/4ebb1627a32474fe4136ba0d865f85ffcee49bc8
commit 4ebb1627a32474fe4136ba0d865f85ffcee49bc8
Author:     Robb Manes <robb.manes>
AuthorDate: Mon Apr 23 14:32:47 2018 -0400
Commit:     Robb Manes <robb.manes>
CommitDate: Mon Apr 23 14:32:47 2018 -0400

    Add reporting session threshold options in settings

    Adds reporting session thresholds to be used in a PR against
    manageiq-ui-classic.

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1572350

 config/settings.yml | 2 +
 1 file changed, 2 insertions(+)

Comment 4 CFME Bot 2018-05-29 08:42:53 UTC
New commit detected on ManageIQ/manageiq-ui-classic/master:

https://github.com/ManageIQ/manageiq-ui-classic/commit/bf463c24f99ed3abfecb1821d9d8f27e7d59b05b
commit bf463c24f99ed3abfecb1821d9d8f27e7d59b05b
Author:     Robb Manes <robb.manes>
AuthorDate: Mon Apr 23 14:34:15 2018 -0400
Commit:     Robb Manes <robb.manes>
CommitDate: Mon Apr 23 14:34:15 2018 -0400

    Add reporting session threshold options for logging

    Replace hard-coded SESSION_LOG_THRESHOLD and SESSION_ELEMENT_THRESHOLD
    with settings that can be configured by a user.

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1572350

 app/controllers/application_controller/session_size.rb | 16 +-
 1 file changed, 3 insertions(+), 13 deletions(-)

Comment 6 Niyaz Akhtar Ansari 2019-01-24 15:01:00 UTC
Verified in Version 5.10.0.32.20190115185124_c957ada

Comment 8 errata-xmlrpc 2019-02-07 23:01:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:0212