Update app.py
Browse files
app.py
CHANGED
|
@@ -142,7 +142,6 @@ class VisualizationEngine:
|
|
| 142 |
text="Severity Level",
|
| 143 |
side="right"
|
| 144 |
),
|
| 145 |
-
titleside="right", # This is deprecated but kept for compatibility
|
| 146 |
tickvals=[0, 1, 2, 3],
|
| 147 |
ticktext=["None", "Low", "Medium", "High"],
|
| 148 |
len=0.8,
|
|
@@ -581,17 +580,33 @@ class OSSModel:
|
|
| 581 |
"""OSS Edition Model (Advisory Only)"""
|
| 582 |
|
| 583 |
def __init__(self):
|
| 584 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 585 |
|
| 586 |
def analyze_and_recommend(self, scenario: Dict) -> Dict[str, Any]:
|
| 587 |
"""Analyze incident and provide recommendations"""
|
| 588 |
try:
|
| 589 |
if self.healing_intent:
|
| 590 |
-
intent
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 595 |
return {
|
| 596 |
"analysis": "✅ Analysis complete",
|
| 597 |
"recommendations": scenario.get("oss_recommendation", "No specific recommendations"),
|
|
@@ -966,7 +981,7 @@ class ARFUltimateInvestorDemo:
|
|
| 966 |
|
| 967 |
# Update metrics display
|
| 968 |
metrics = scenario.get("current_metrics", {})
|
| 969 |
-
|
| 970 |
|
| 971 |
# Create visualization based on type
|
| 972 |
if viz_type == "Radar Chart":
|
|
@@ -974,17 +989,24 @@ class ARFUltimateInvestorDemo:
|
|
| 974 |
elif viz_type == "Heatmap":
|
| 975 |
viz = self.viz_engine.create_heatmap_timeline(self.viz_engine.incident_history)
|
| 976 |
else: # Stream
|
| 977 |
-
|
| 978 |
-
|
| 979 |
-
|
| 980 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 981 |
|
| 982 |
# Update heatmap
|
| 983 |
incident_heatmap = self.viz_engine.create_heatmap_timeline(self.viz_engine.incident_history)
|
| 984 |
|
| 985 |
return {
|
| 986 |
metrics_display: metrics,
|
| 987 |
-
business_impact:
|
| 988 |
visualization_output: viz,
|
| 989 |
heatmap_output: incident_heatmap
|
| 990 |
}
|
|
|
|
| 142 |
text="Severity Level",
|
| 143 |
side="right"
|
| 144 |
),
|
|
|
|
| 145 |
tickvals=[0, 1, 2, 3],
|
| 146 |
ticktext=["None", "Low", "Medium", "High"],
|
| 147 |
len=0.8,
|
|
|
|
| 580 |
"""OSS Edition Model (Advisory Only)"""
|
| 581 |
|
| 582 |
def __init__(self):
|
| 583 |
+
# Provide default values for HealingIntent constructor
|
| 584 |
+
if OSS_AVAILABLE:
|
| 585 |
+
try:
|
| 586 |
+
# Check if HealingIntent requires arguments
|
| 587 |
+
self.healing_intent = HealingIntent("scale", "database")
|
| 588 |
+
logger.info("HealingIntent initialized with action='scale', component='database'")
|
| 589 |
+
except Exception as e:
|
| 590 |
+
logger.warning(f"HealingIntent initialization failed: {e}")
|
| 591 |
+
self.healing_intent = None
|
| 592 |
+
else:
|
| 593 |
+
self.healing_intent = None
|
| 594 |
|
| 595 |
def analyze_and_recommend(self, scenario: Dict) -> Dict[str, Any]:
|
| 596 |
"""Analyze incident and provide recommendations"""
|
| 597 |
try:
|
| 598 |
if self.healing_intent:
|
| 599 |
+
# Try to create intent with proper arguments
|
| 600 |
+
try:
|
| 601 |
+
intent = self.healing_intent.create_intent(
|
| 602 |
+
issue_type=scenario.get("name", "Unknown"),
|
| 603 |
+
symptoms=scenario.get("description", ""),
|
| 604 |
+
urgency="HIGH" if scenario.get("severity") in ["HIGH", "CRITICAL"] else "MEDIUM"
|
| 605 |
+
)
|
| 606 |
+
except Exception as e:
|
| 607 |
+
logger.warning(f"create_intent failed: {e}")
|
| 608 |
+
intent = "create_scale_out_intent"
|
| 609 |
+
|
| 610 |
return {
|
| 611 |
"analysis": "✅ Analysis complete",
|
| 612 |
"recommendations": scenario.get("oss_recommendation", "No specific recommendations"),
|
|
|
|
| 981 |
|
| 982 |
# Update metrics display
|
| 983 |
metrics = scenario.get("current_metrics", {})
|
| 984 |
+
business_impact_data = scenario.get("business_impact", {})
|
| 985 |
|
| 986 |
# Create visualization based on type
|
| 987 |
if viz_type == "Radar Chart":
|
|
|
|
| 989 |
elif viz_type == "Heatmap":
|
| 990 |
viz = self.viz_engine.create_heatmap_timeline(self.viz_engine.incident_history)
|
| 991 |
else: # Stream
|
| 992 |
+
# Create sample stream data
|
| 993 |
+
stream_data = []
|
| 994 |
+
for i in range(24):
|
| 995 |
+
data_point = {"timestamp": f"{i:02d}:00"}
|
| 996 |
+
for key, value in metrics.items():
|
| 997 |
+
if isinstance(value, (int, float)):
|
| 998 |
+
# Add some variation to make stream look realistic
|
| 999 |
+
variation = random.uniform(-0.1, 0.1) * value
|
| 1000 |
+
data_point[key] = max(0, value + variation)
|
| 1001 |
+
stream_data.append(data_point)
|
| 1002 |
+
viz = self.viz_engine.create_stream_graph(stream_data)
|
| 1003 |
|
| 1004 |
# Update heatmap
|
| 1005 |
incident_heatmap = self.viz_engine.create_heatmap_timeline(self.viz_engine.incident_history)
|
| 1006 |
|
| 1007 |
return {
|
| 1008 |
metrics_display: metrics,
|
| 1009 |
+
business_impact: business_impact_data,
|
| 1010 |
visualization_output: viz,
|
| 1011 |
heatmap_output: incident_heatmap
|
| 1012 |
}
|