Skip to content

Commit

Permalink
rebalance plot: Handle rebalance_report with missing fields
Browse files Browse the repository at this point in the history
Change-Id: Idec0de6691ff9500984a5370f5c480edd4937834
Reviewed-on: https://review.couchbase.org/c/ns_server/+/203195
Reviewed-by: Steve Watanabe <steve.watanabe@couchbase.com>
Tested-by: Peter Searby <peter.searby@couchbase.com>
  • Loading branch information
Peter-Searby committed Jan 30, 2024
1 parent 99c5227 commit 1fcc43f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions scripts/jq/rebalance_report/parser.py
Expand Up @@ -16,13 +16,27 @@


def get_vbucket_moves(report, bucket):
stage_infos = report["stageInfo"]
if not report.get("is_rebalancing", True):
print("Rebalance wasn't running")
return []

data_info = stage_infos["data"]
stage_infos = report.get("stageInfo")
if stage_infos is None:
print("No stageInfo found")
return []

details = data_info["details"]
data_info = stage_infos.get("data")
if data_info is None:
print("No data service rebalance found")
return []

details = data_info.get("details")
if details is None:
print("No details found")
return []

if bucket not in details:
print(f"No details found for bucket '{bucket}'")
return []

bucket_details = details[bucket]
Expand Down

0 comments on commit 1fcc43f

Please sign in to comment.