The blast_radius() method provides comprehensive impact analysis by combining upstream and downstream dependency traversal with team ownership data. This gives you a complete picture of what would be affected if a node fails, changes, or is removed.This is particularly useful for:
# Before deploying a breaking changeservice_id = "service:auth-service"impact = query_engine.blast_radius(service_id)if impact['total_affected_nodes'] > 10: print("⚠️ HIGH RISK DEPLOYMENT") print(f" Affects {len(impact['affected_teams'])} teams") print(f" Impacts {len(impact['upstream_dependencies'])} services") # Notify affected teams print("\n📧 Teams to notify:") for team in impact['affected_teams']: print(f" - {team}")else: print("✓ Low risk deployment")
impact = query_engine.blast_radius("service:payment-api")print(f"=== Blast Radius Analysis for {impact['center_node']['name']} ===")print(f"\nNode Type: {impact['center_node']['type']}")print(f"\n📤 UPSTREAM IMPACT ({len(impact['upstream_dependencies'])} nodes)")print(" Services that will break if this fails:")for node in impact['upstream_dependencies'][:5]: # Show first 5 print(f" - {node['name']} ({node['type']}) [distance: {node['distance']}]")print(f"\n📥 DOWNSTREAM DEPENDENCIES ({len(impact['downstream_dependencies'])} nodes)")print(" Components this service needs:")for node in impact['downstream_dependencies'][:5]: # Show first 5 print(f" - {node['name']} ({node['type']}) [distance: {node['distance']}]")print(f"\n👥 AFFECTED TEAMS ({len(impact['affected_teams'])} teams)")for team in impact['affected_teams']: print(f" - {team}")print(f"\n📊 SUMMARY")print(f" {impact['summary']}")
# During an outagefailed_service = "database:postgres-main"impact = query_engine.blast_radius(failed_service)print("🚨 INCIDENT IMPACT REPORT")print(f"\nFailed component: {impact['center_node']['name']}")print(f"\n⚠️ {len(impact['upstream_dependencies'])} services are likely DOWN")# Group affected services by teamfrom collections import defaultdictteam_services = defaultdict(list)for node in impact['upstream_dependencies']: # Get owner for each affected node owner = query_engine.get_owner(node['id']) if owner: team_services[owner['name']].append(node['name'])print("\nImpact by team:")for team, services in team_services.items(): print(f"\n {team} ({len(services)} services):") for service in services: print(f" - {service}")