Skip to content

fix(#193): handle list API responses gracefully in getServers and HealthRulesAndAlerting#194

Open
alexafshar wants to merge 1 commit into
Appdynamics:masterfrom
alexafshar:bug/193-typeerror-crash-on-api-response
Open

fix(#193): handle list API responses gracefully in getServers and HealthRulesAndAlerting#194
alexafshar wants to merge 1 commit into
Appdynamics:masterfrom
alexafshar:bug/193-typeerror-crash-on-api-response

Conversation

@alexafshar

Copy link
Copy Markdown
Collaborator

Summary

Fixes #193
When the AppDynamics API returns a list instead of the expected dict for getEventCounts (APM/BRUM/MRUM) or getServerAvailability, the tool crashed with a fatal TypeError that aborted the entire job.

Changes

  • AppDService.getServers — Guard serverAvailabilityResult.data with an isinstance(dict) check before key access; default availability to None with a warning log.
  • HealthRulesAndAlertingAPM/BRUM/MRUM extract() — Guard eventCounts[idx].data with an error/type check; default to zero violations so analyze() can proceed safely.

Behaviour after fix

  • No job abort on malformed API responses.
  • A WARNING log entry is emitted for each affected application/machine.
  • Affected applications report 0 health rule violations rather than crashing.

…ers and HealthRulesAndAlerting

When the AppDynamics API returns a list instead of the expected dict for
getEventCounts (APM/BRUM/MRUM) or getServerAvailability, the tool crashed
with a fatal TypeError aborting the entire job.
- AppDService.getServers: guard serverAvailabilityResult.data with an
  isinstance(dict) check; default availability to None with a warning log.
- HealthRulesAndAlertingAPM/BRUM/MRUM extract: guard eventCounts[idx].data
  with an error/type check; default to zero violations so analyze() proceeds.
Fixes Appdynamics#193
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: TypeError crash when API returns a list instead of dict for eventCounts / serverAvailability

1 participant