Skip to content

Commit

Permalink
implement #87 (add description column for APM excel reports), #125 (f…
Browse files Browse the repository at this point in the history
…ix post processing error when no synthetics jobs on customer controller)
  • Loading branch information
alexafshar committed Apr 1, 2024
1 parent 6c963ab commit 494a1d9
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 27 deletions.
30 changes: 19 additions & 11 deletions backend/extractionSteps/JobStepBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,39 @@ def reportData(
return

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

writeUncoloredRow(rawDataSheet, 1, headers)

# Write Data
rowIdx = 2
for host, hostInfo in controllerData.items():
for application in hostInfo[self.componentType].values():
if colorRows:
data = [
( hostInfo["controller"].host, None),
( application["name"], None),
*[application[jobStepName][metricFolder][header] for header in rawDataHeaders]
]
if self.componentType == "apm":
data.insert(2, ( application["description"], None))
writeColoredRow(
rawDataSheet,
rowIdx,
[
(hostInfo["controller"].host, None),
(application["name"], None),
*[application[jobStepName][metricFolder][header] for header in rawDataHeaders],
],
data
)
else:
data = [
hostInfo["controller"].host,
application["name"],
*[application[jobStepName][metricFolder][header] for header in rawDataHeaders]
]
if self.componentType == "apm":
data.insert(2, application["description"])
writeUncoloredRow(
rawDataSheet,
rowIdx,
[
hostInfo["controller"].host,
application["name"],
*[application[jobStepName][metricFolder][header] for header in rawDataHeaders],
],
data
)
rowIdx += 1

Expand Down
10 changes: 6 additions & 4 deletions backend/output/presentations/cxPptFsoUseCases.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ class ExcelSheets(object):
def __init__(self, directory: str, filenames: tuple):
self.workbooks = {}
for filename in filenames:
full_path = os.path.join(directory, filename)
self.workbooks[filename] = pd.read_excel(full_path, sheet_name=None)
try:
full_path = os.path.join(directory, filename)
self.workbooks[filename] = pd.read_excel(full_path, sheet_name=None)
except Exception as e:
logging.warning(f"Not able to load workbook {filename}")
logging.warning(f"Was it generated to begin with? Ignoring.")

def findSheetByHeader(self, header_name):
result = []
Expand Down Expand Up @@ -539,8 +543,6 @@ def createCxHamUseCasePpt(folder: str):
f"{file_prefix}-Synthetics.xlsx"
))

assert len(excels.getWorkBooks()) == 11

# currently only 1st controller in the job file is examined.
controller = getValuesInColumn(apm_wb["Analysis"], "controller")[0]

Expand Down
35 changes: 23 additions & 12 deletions backend/output/reports/MaturityAssessmentReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,41 @@ def createWorkbook(self, jobs, controllerData, jobFileName):
jobNameCols.append(name if not name.startswith("OverallAssessment") else "OverallAssessment")
jobStep.reportData(workbook, controllerData, name)

data_header = [
"controller",
"componentType",
"name",
*jobNameCols,
]

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

# Write Headers
writeUncoloredRow(
analysisSheet,
1,
[
"controller",
"componentType",
"name",
*jobNameCols,
],
data_header
)

rowIdx = 2
for host, hostInfo in controllerData.items():
for component in hostInfo[reportType].values():

data_row = [
(hostInfo["controller"].host, None),
(reportType, None),
(component["name"], None),
*[component[jobStep]["computed"] for jobStep in [type(jobStep).__name__ for jobStep in filteredJobs]],
]

if reportType == "apm": # add desc after name
data_row.insert(3, (component["description"], None))

writeColoredRow(
analysisSheet,
rowIdx,
[
(hostInfo["controller"].host, None),
(reportType, None),
(component["name"], None),
*[component[jobStep]["computed"] for jobStep in [type(jobStep).__name__ for jobStep in filteredJobs]],
],
data_row
)
rowIdx += 1

Expand Down

0 comments on commit 494a1d9

Please sign in to comment.