Skip to content

Commit

Permalink
fixed report generation due to faulty response payload (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexafshar authored Apr 26, 2024
1 parent 5aa643e commit 7e5ddfa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 18 additions & 1 deletion backend/api/appd/AppDService.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,24 @@ async def getServers(self) -> Result:
response = await self.controller.getServersKeys(json.dumps(body))
serverKeys = await self.getResultFromResponse(response, debugString)

machineIds = [serverKey["machineId"] for serverKey in serverKeys.data["machineKeys"]]
machineIds = []
if not isinstance(serverKeys.data["machineKeys"], list):
logging.warning("Expected 'serverKeys.data[\"machineKeys\"]' to be a "
"list, but got {}".format(type(serverKeys.data["machineKeys"])))
else:
for serverKey in serverKeys.data["machineKeys"]:
if isinstance(serverKey, dict) and "machineId" in serverKey:
try:
machineIds.append(serverKey["machineId"])
except TypeError:
logging.warning("TypeError encountered with "
"machineId: {}".format(serverKey["machineId"]))
else:
if isinstance(serverKey, dict):
logging.warning("Dictionary lacks 'machineId' key: {}".format(serverKey))
else:
logging.warning("Expected a dictionary, but found type: {}".format(type(serverKey)))


serverFutures = [self.controller.getServer(serverId) for serverId in machineIds]
serversResponses = await AsyncioUtils.gatherWithConcurrency(*serverFutures)
Expand Down
4 changes: 3 additions & 1 deletion backend/output/presentations/cxPptFsoUseCases.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,9 @@ def cleanup_slides(root: Presentation, uc: UseCase):
def calculate_kpis(apm_wb, agent_wb, uc: UseCase):
# currently only supports one controller report out of the workbook
controller = getValuesInColumn(apm_wb["Analysis"], "controller")[0]
logging.info(f"processing report for 1st controller only as multiple controllers are not supported yet: {controller}")
logging.info(f"processing CX HAM Use Case report for 1st controller only "
f"as multiple "
f"controllers are not supported yet: {controller}")

totalApplications = getRowCountForController(apm_wb["Analysis"], controller)
percentAgentsReportingData = getValuesInColumnForController(apm_wb["AppAgentsAPM"], "percentAgentsReportingData", controller)
Expand Down

0 comments on commit 7e5ddfa

Please sign in to comment.