Skip to content

Commit eec5c45

Browse files
anshbansalRyanHolstien
authored andcommitted
fix(ingest/grafana): add exception handling (#14921)
1 parent 8c75384 commit eec5c45

File tree

1 file changed

+9
-1
lines changed
  • metadata-ingestion/src/datahub/ingestion/source/grafana

1 file changed

+9
-1
lines changed

metadata-ingestion/src/datahub/ingestion/source/grafana/models.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
- Dashboard JSON structure: https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/view-dashboard-json-model/
99
"""
1010

11+
import logging
1112
from typing import Any, Dict, List, Optional
1213

1314
from pydantic import BaseModel, ConfigDict, Field
1415

1516
from datahub.emitter.mcp_builder import ContainerKey
1617

18+
logger = logging.getLogger(__name__)
1719
# Grafana-specific type definitions for better type safety
1820
GrafanaQueryTarget = Dict[
1921
str, Any
@@ -89,7 +91,13 @@ def extract_panels(panels_data: List[Dict[str, Any]]) -> List[Panel]:
8991
def parse_obj(cls, data: Dict[str, Any]) -> "Dashboard":
9092
"""Custom parsing to handle nested panel extraction."""
9193
dashboard_data = data.get("dashboard", {})
92-
panels = cls.extract_panels(dashboard_data.get("panels", []))
94+
_panel_data = dashboard_data.get("panels", [])
95+
try:
96+
panels = cls.extract_panels(_panel_data)
97+
except Exception as e:
98+
logger.warning(
99+
f"Error extracting panels from dashboard for dashboard panels {_panel_data} : {e}"
100+
)
93101

94102
# Extract meta.folderId from nested structure
95103
meta = dashboard_data.get("meta", {})

0 commit comments

Comments
 (0)