Shirly Radco has uploaded a new change for review.

Change subject: reports: dr16 report - added comments to queries
......................................................................

reports: dr16 report - added comments to queries

Changed the code structure so it will be more readable
and added commets.

Change-Id: I902ae37df4988ed1bf1fa350514f3d52d1d47678
Signed-off-by: Shirly Radco <[email protected]>
---
M 
packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/top_five_clusters_host_downtime_dr16_jrxml.data
1 file changed, 84 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/08/27908/1

diff --git 
a/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/top_five_clusters_host_downtime_dr16_jrxml.data
 
b/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/top_five_clusters_host_downtime_dr16_jrxml.data
index dad379b..66fa7f0 100644
--- 
a/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/top_five_clusters_host_downtime_dr16_jrxml.data
+++ 
b/packaging/ovirt-reports/resources/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/top_five_clusters_host_downtime_dr16_jrxml.data
@@ -1,24 +1,92 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Created with Jaspersoft Studio version 5.5.0-->
 <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports 
http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"; 
name="top_five_clusters_host_downtime_dr16" language="groovy" pageWidth="445" 
pageHeight="260" whenNoDataType="AllSectionsNoDetail" columnWidth="445" 
leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" 
resourceBundle="ovirt_reports_bundle" whenResourceMissingType="Error" 
uuid="463ea43a-6041-4368-b70a-8e03014018e2">
        <property name="ireport.zoom" value="1.0"/>
        <property name="ireport.x" value="0"/>
        <property name="ireport.y" value="0"/>
-       <property name="ireport.jasperserver.reportUnit" 
value="/reports_resources/webadmin_dashboards/ce/datacenter_dashboard"/>
-       <property name="ireport.jasperserver.url" 
value="http://localhost:8080/jasperserver-pro/services/repository"/>
-       <parameter name="P_DataCenter_ID" class="java.lang.String">
-               <defaultValueExpression><![CDATA[]]></defaultValueExpression>
-       </parameter>
-       <queryString>
-               <![CDATA[SELECT v3_5_latest_configuration_hosts.cluster_id, 
v3_5_latest_configuration_clusters.cluster_name,
-       (SUM(CASE WHEN 
v3_5_statistics_hosts_resources_usage_samples.host_status = 1 THEN 
coalesce(v3_5_statistics_hosts_resources_usage_samples.minutes_in_status,0) 
ELSE 0 END) / 
SUM(v3_5_statistics_hosts_resources_usage_samples.minutes_in_status)) * 100 as 
uptime_percent,
-       (SUM(CASE WHEN 
v3_5_statistics_hosts_resources_usage_samples.host_status = 2 THEN 
coalesce(v3_5_statistics_hosts_resources_usage_samples.minutes_in_status,0) 
ELSE 0 END) / 
SUM(v3_5_statistics_hosts_resources_usage_samples.minutes_in_status)) * 100 AS 
planned_downtime_percent,
-       (SUM(CASE WHEN 
v3_5_statistics_hosts_resources_usage_samples.host_status = 3 THEN 
coalesce(v3_5_statistics_hosts_resources_usage_samples.minutes_in_status,0) 
ELSE 0 END) / 
SUM(v3_5_statistics_hosts_resources_usage_samples.minutes_in_status)) * 100 AS 
unplanned_downtime_percent
+       <property name="ireport.jasperserver.url" 
value="http://localhost:8080/jasperserver-pro/"/>
+       <property name="ireport.jasperserver.report.resource" 
value="/reports_resources/embedded_reports/webadmin_dashboards/dc_dashboard/jrxmls/top_five_clusters_host_downtime_dr16_jrxml"/>
+       <parameter name="P_DataCenter_ID" class="java.lang.String"/>
+       <queryString language="SQL">
+               <![CDATA[-- DR16 - This query returns for the 5 clusters with 
the most downtime,
+-- the uptime, planned downtime and unplanned downtime percent.
+
+SELECT
+    v3_5_latest_configuration_hosts.cluster_id,
+    v3_5_latest_configuration_clusters.cluster_name,
+    (
+        SUM (
+            CASE
+                WHEN v3_5_statistics_hosts_resources_usage_samples.host_status 
= 1
+                    THEN
+                        coalesce (
+                            
v3_5_statistics_hosts_resources_usage_samples.minutes_in_status,
+                            0
+                        )
+                ELSE 0
+            END
+        ) /
+        SUM (
+            v3_5_statistics_hosts_resources_usage_samples.minutes_in_status
+        )
+    ) * 100
+    AS uptime_percent,
+    (
+        SUM (
+            CASE
+                WHEN v3_5_statistics_hosts_resources_usage_samples.host_status 
= 2
+                    THEN
+                        coalesce (
+                            
v3_5_statistics_hosts_resources_usage_samples.minutes_in_status,
+                            0
+                        )
+                ELSE 0
+            END
+        ) /
+        SUM (
+            v3_5_statistics_hosts_resources_usage_samples.minutes_in_status
+        )
+    ) * 100
+    AS planned_downtime_percent,
+    (
+        SUM (
+            CASE
+                WHEN v3_5_statistics_hosts_resources_usage_samples.host_status 
= 3
+                    THEN
+                        coalesce (
+                            
v3_5_statistics_hosts_resources_usage_samples.minutes_in_status,
+                            0
+                        )
+                ELSE 0
+            END
+        ) /
+        SUM (
+            v3_5_statistics_hosts_resources_usage_samples.minutes_in_status
+        )
+    ) * 100
+    AS unplanned_downtime_percent
 FROM v3_5_statistics_hosts_resources_usage_samples
-     INNER JOIN v3_5_latest_configuration_hosts ON 
(v3_5_latest_configuration_hosts.host_id = 
v3_5_statistics_hosts_resources_usage_samples.host_id)
-         INNER JOIN v3_5_latest_configuration_clusters ON 
(v3_5_latest_configuration_hosts.cluster_id = 
v3_5_latest_configuration_clusters.cluster_id)
-WHERE v3_5_latest_configuration_clusters.datacenter_id = 
cast($P{P_DataCenter_ID} as UUID)
-GROUP BY v3_5_latest_configuration_hosts.cluster_id, 
v3_5_latest_configuration_clusters.cluster_name
-ORDER BY uptime_percent ASC, unplanned_downtime_percent DESC, 
planned_downtime_percent DESC
+    INNER JOIN v3_5_latest_configuration_hosts
+        ON (
+            v3_5_latest_configuration_hosts.host_id =
+            v3_5_statistics_hosts_resources_usage_samples.host_id
+        )
+    INNER JOIN v3_5_latest_configuration_clusters
+        ON (
+            v3_5_latest_configuration_hosts.cluster_id =
+            v3_5_latest_configuration_clusters.cluster_id
+        )
+WHERE
+    -- Here we filter the datacenter chosen by the user
+    v3_5_latest_configuration_clusters.datacenter_id =
+    CAST ( $P{P_DataCenter_ID} AS UUID )
+GROUP BY
+    v3_5_latest_configuration_hosts.cluster_id,
+    v3_5_latest_configuration_clusters.cluster_name
+ORDER BY
+    uptime_percent ASC,
+    unplanned_downtime_percent DESC,
+    planned_downtime_percent DESC
 LIMIT 5]]>
        </queryString>
        <field name="cluster_id" class="java.lang.Object"/>
@@ -30,7 +98,7 @@
                <band height="260" splitType="Stretch">
                        <stackedBarChart>
                                <chart evaluationTime="Report" 
customizerClass="com.ovirt.reports.jasper.DrStackedBarChartCustomizer" 
theme="WebadminLineBarChartTheme">
-                                       <reportElement 
uuid="d49201a8-9a58-49c0-8de8-ad901a3220fd" mode="Transparent" x="0" y="0" 
width="445" height="260"/>
+                                       <reportElement mode="Transparent" x="0" 
y="0" width="445" height="260" uuid="d49201a8-9a58-49c0-8de8-ad901a3220fd"/>
                                        <chartTitle>
                                                <font fontName="SansSerif" 
size="10"/>
                                                
<titleExpression><![CDATA[$R{dr16.title}]]></titleExpression>


-- 
To view, visit http://gerrit.ovirt.org/27908
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I902ae37df4988ed1bf1fa350514f3d52d1d47678
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-reports
Gerrit-Branch: master
Gerrit-Owner: Shirly Radco <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to