Skip to content

Commit

Permalink
Merge pull request #148 from isiryder/feature/145-add-app-id-to-report
Browse files Browse the repository at this point in the history
Feature: Add applicationId hidden field to reports (#145)
  • Loading branch information
alexafshar authored Oct 21, 2024
2 parents 59bab47 + a4625ae commit b4d8c33
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 13 deletions.
11 changes: 7 additions & 4 deletions backend/extractionSteps/JobStepBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ def reportData(
return

rawDataHeaders = list(list(controllerData.values())[0][self.componentType].values())[0][jobStepName][metricFolder].keys()
headers = ["controller", "application"] + (["description"] if self.componentType == "apm" else []) + list(rawDataHeaders)
headers = ["controller", "application", "applicationId"] + (["description"] if self.componentType == "apm" else []) + list(rawDataHeaders)

writeUncoloredRow(rawDataSheet, 1, headers)
rawDataSheet.column_dimensions["C"].hidden = True

# Write Data
rowIdx = 2
Expand All @@ -61,10 +62,11 @@ def reportData(
data = [
( hostInfo["controller"].host, None),
( application["name"], None),
( application["applicationId"] if self.componentType == "mrum" else application["id"], None),
*[application[jobStepName][metricFolder][header] for header in rawDataHeaders]
]
if self.componentType == "apm":
data.insert(2, ( application["description"], None))
data.insert(3, ( application["description"], None))
writeColoredRow(
rawDataSheet,
rowIdx,
Expand All @@ -74,18 +76,19 @@ def reportData(
data = [
hostInfo["controller"].host,
application["name"],
application["applicationId"] if self.componentType == "mrum" else application["id"],
*[application[jobStepName][metricFolder][header] for header in rawDataHeaders]
]
if self.componentType == "apm":
data.insert(2, application["description"])
data.insert(3, application["description"])
writeUncoloredRow(
rawDataSheet,
rowIdx,
data
)
rowIdx += 1

addFilterAndFreeze(rawDataSheet)
addFilterAndFreeze(rawDataSheet, "E2") if self.componentType == "apm" else addFilterAndFreeze(rawDataSheet, "D2")
resizeColumnWidth(rawDataSheet)

def applyThresholds(self, analysisDataEvaluatedMetrics, analysisDataRoot, jobStepThresholds):
Expand Down
10 changes: 8 additions & 2 deletions backend/output/reports/AgentMatrixReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def createWorkbook(self, jobs, controllerData, jobFileName):

logging.debug(f"Creating workbook sheet for App Agents")
appAgentsSheet = workbook.create_sheet(f"Overall - App Agents")
writeUncoloredRow(appAgentsSheet, 1, ["controller", "application", *allAppAgentVersions])
writeUncoloredRow(appAgentsSheet, 1, ["controller", "application", "applicationId", *allAppAgentVersions])
appAgentsSheet.column_dimensions["C"].hidden = True

# Write Data
rowIdx = 2
for host, hostInfo in controllerData.items():
Expand All @@ -41,6 +43,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
[
hostInfo["controller"].host,
application["name"],
application["id"],
*agentCountRow,
],
)
Expand All @@ -60,8 +63,10 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
writeUncoloredRow(
machineAgentsSheet,
1,
["controller", "application", *allMachineAgentVersions],
["controller", "application", "applicationId", *allMachineAgentVersions],
)
machineAgentsSheet.column_dimensions["C"].hidden = True

# Write Data
rowIdx = 2
for host, hostInfo in controllerData.items():
Expand All @@ -80,6 +85,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
[
hostInfo["controller"].host,
application["name"],
application["id"],
*agentCountRow,
],
)
Expand Down
6 changes: 5 additions & 1 deletion backend/output/reports/CustomMetricsReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
"controller",
"componentType",
"application",
"applicationId",
*allExtensions,
],
)

summarySheet.column_dimensions["D"].hidden = True

rowIdx = 2
for host, hostInfo in controllerData.items():
for component in hostInfo["apm"].values():
Expand All @@ -43,12 +46,13 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
hostInfo["controller"].host,
"apm",
component["name"],
component["id"],
*[(True if e in component["customMetrics"] else False) for e in allExtensions],
],
)
rowIdx += 1

addFilterAndFreeze(summarySheet)
addFilterAndFreeze(summarySheet, "E2")
resizeColumnWidth(summarySheet)

logging.debug(f"Saving CustomMetrics Workbook")
Expand Down
2 changes: 1 addition & 1 deletion backend/output/reports/DashboardReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
)
rowIdx += 1

addFilterAndFreeze(dashboardSheet)
addFilterAndFreeze(dashboardSheet, "C2")
resizeColumnWidth(dashboardSheet)

logging.debug(f"Saving Dashboard Workbook")
Expand Down
2 changes: 1 addition & 1 deletion backend/output/reports/LicenseReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
)
rowIdx += 1

addFilterAndFreeze(licenseSheet)
addFilterAndFreeze(licenseSheet, "C2")
resizeColumnWidth(licenseSheet)

logging.debug(f"Saving License Workbook")
Expand Down
7 changes: 5 additions & 2 deletions backend/output/reports/MaturityAssessmentReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
"controller",
"componentType",
"name",
"applicationId",
*jobNameCols,
]

if reportType == "apm": # add desc header after name
data_header.insert(3, "description")
data_header.insert(4, "description")

# Write Headers
writeUncoloredRow(
analysisSheet,
1,
data_header
)
analysisSheet.column_dimensions["D"].hidden = True

rowIdx = 2
for host, hostInfo in controllerData.items():
Expand All @@ -51,6 +53,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
(hostInfo["controller"].host, None),
(reportType, None),
(component["name"], None),
(component["applicationId"] if reportType == "mrum" else component["id"], None),
*[component[jobStep]["computed"] for jobStep in [type(jobStep).__name__ for jobStep in filteredJobs]],
]

Expand All @@ -64,7 +67,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
)
rowIdx += 1

addFilterAndFreeze(analysisSheet)
addFilterAndFreeze(analysisSheet, "E2")
resizeColumnWidth(analysisSheet)

# Now that we have the data , Populate the summary sheet with headers
Expand Down
5 changes: 4 additions & 1 deletion backend/output/reports/SyntheticsReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
"host": (host, color),
"componentType": ("brum", color),
"application": (application["name"], color),
"applicationId": (application["id"], color),
"jobName": (syntheticJob["config"]["description"], color),
"numberOfWebDriverCalls": (numberOfWebDriverCalls, color),
"projectedDailyRuns": (syntheticJob["config"]["projectedUsage"]["projectedDailyRuns"], color),
Expand Down Expand Up @@ -95,7 +96,9 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
)
rowIdx += 1

addFilterAndFreeze(summarySheet, freezePane="E2")
summarySheet.column_dimensions["D"].hidden = True

addFilterAndFreeze(summarySheet, freezePane="F2")
resizeColumnWidth(summarySheet)

logging.debug(f"Saving Synthetics Workbook")
Expand Down
2 changes: 1 addition & 1 deletion backend/util/excel_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def resizeColumnWidth(sheet: Worksheet):
sheet.column_dimensions[col].width = value + headerFilterArrowPadding


def addFilterAndFreeze(sheet: Worksheet, freezePane: str = "C2"):
def addFilterAndFreeze(sheet: Worksheet, freezePane: str = "D2"):
"""Add filter on headers and freeze the first 2 columns and 1 row."""
sheet.auto_filter.ref = sheet.dimensions
# Freeze controller and application columns
Expand Down

0 comments on commit b4d8c33

Please sign in to comment.