Bug 1620246

Summary: UI Monitor Alerts page is slow to load and when clicking on link it shows blank page with no alerts
Product: Red Hat CloudForms Management Engine Reporter: Tuan <tuado>
Component: UI - OPSAssignee: Keenan Brock <kbrock>
Status: CLOSED CURRENTRELEASE QA Contact: Angelina Vasileva <anikifor>
Severity: high Docs Contact:
Priority: high    
Version: 5.9.2CC: dmetzger, hkataria, lavenel, mpovolny, obarenbo, rmanes, simaishi, smallamp, tuado
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.10.0.14 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1629127 (view as bug list) Environment:
Last Closed: 2019-02-12 16:52:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1629127    

Comment 2 dmetzger 2018-08-23 13:49:53 UTC
Please retest with 5.9.4.

Comment 4 dmetzger 2018-08-28 11:51:29 UTC
Based onhttps://bugzilla.redhat.com/show_bug.cgi?id=1620246#c3 I'm assigning this ticket to the Performance Team to perform an initial triage.

Comment 5 Keenan Brock 2018-08-28 16:06:28 UTC
**Status:**

Darn. Nothing is displayed for me.
My javascript console displays:

1 error complaining that alertData.resource is null (so it couldn't find the type)
  (I did translate from obfuscated to source code)
https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/assets/javascripts/services/alerts_center_service.js#L492

The resources are fetched from /api/alerts?expand=resources,alert_actions&attributes=assignee,resource&filter[]=resolved=false&filter[]=or+resolved=nil
of the 1,000 records, 33 of the "Container Replicator Successfully Created Pod" alerts point to a defunct ContainerReplicator.

alert:
{"id"=>"1000000000010", "miq_alert_id"=>"1000000000047", "resource_id"=>"1000000000095", "resource_type"=>"ContainerReplicator", "evaluated_on"=>"2018-05-09T15:24:47Z", "result"=>true, "ems_id"=>"1000000000001", "description"=>"Container Replicator Successfully Created Pod"}  

MiqAlert:

{"id":1000000000010,"description":"VM CPU count was increased","created_on":"2018-04-11T14:35:16.743Z","options":{"notifications":{"email":{"from":"","to":[]}}},"db":"Vm","miq_expression":null,"responds_to_events":"vm_reconfigure","enabled":null,"read_only":true,"hash_expression":{"mode":"internal","options":{"operator":"Increased","hdw_attr":"cpu_total_cores"},"eval_method":"reconfigured_hardware_value"},"severity":null}


I will submit a PR to fix the javascript error.

**Question:**

Tuan, Is it ok if I delete these bad alerts so I can get back to the actual performance issue?

Thnx, Keenan

Comment 6 Tuan 2018-08-28 16:40:53 UTC
Keena,
        Go ahead and delete the alerts you need to. I have a clone of this appliance up and running.

Tuan

Comment 7 Keenan Brock 2018-08-30 01:00:58 UTC
Deleted all alert statuses where the resources no longer existed. I did have quite a few mis-deletes, but there are still 1,1834 alert statuses - which is above 1k alert status for the first page.

Now, everything seems to work.
Sure, the 1.25 sec to load the tags and 9 sec to load the alerts makes for a slowish page.


I think this is a bug and not a performance issue

-----
notes:

MiqAlertStatus.distinct.pluck(:resource_type).each { |model| model_ids = MiqAlertStatus.where(:resource_type => model).where.not(:resource_id => model.constantize.select(:id)).pluck(:id) ; puts "#{model}: #{model_ids.count} (#{model_ids.first})" ; MiqAlertStatus.destroy_all(:id => model_ids) }

Comment 9 CFME Bot 2018-08-30 09:22:42 UTC
New commit detected on ManageIQ/manageiq-ui-classic/master:

https://github.com/ManageIQ/manageiq-ui-classic/commit/5f3b6ac78b5f601cc36a068503c1f276beb56e10
commit 5f3b6ac78b5f601cc36a068503c1f276beb56e10
Author:     Keenan Brock <keenan>
AuthorDate: Wed Aug 29 18:34:30 2018 -0400
Commit:     Keenan Brock <keenan>
CommitDate: Wed Aug 29 18:34:30 2018 -0400

    Handle Alerts with no resources

    An alert can point to an invalid resource if the resource is deleted
    We tend to avoid this, but in one case, Container Replicators can go away

    https://bugzilla.redhat.com/show_bug.cgi?id=1620246
 app/assets/javascripts/services/alerts_center_service.js | 5 +-
 1 file changed, 3 insertions(+), 2 deletions(-)

Comment 10 Keenan Brock 2018-08-30 18:46:16 UTC
Tuan, thanks for your help. you should be all set

Comment 12 Angelina Vasileva 2018-10-10 07:50:56 UTC
Fixed and verified in 5.10.0.18.20181003162715_dfcff5a