Skip to content

Commit a71aa6c

Browse files
committed
fix(airflow): add catalog classification and env loading
1 parent 243c455 commit a71aa6c

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

app/integrations/catalog.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
from typing import Any
99

1010
from app.config import get_tracer_base_url
11+
from app.integrations.airflow import (
12+
DEFAULT_AIRFLOW_BASE_URL,
13+
airflow_config_from_env,
14+
build_airflow_config,
15+
)
1116
from app.integrations.azure_sql import build_azure_sql_config
1217
from app.integrations.github_mcp import build_github_mcp_config
1318
from app.integrations.gitlab import DEFAULT_GITLAB_BASE_URL, build_gitlab_config
@@ -79,6 +84,8 @@
7984
"opensearch": "opensearch",
8085
"open search": "opensearch",
8186
"alertmanager": "alertmanager",
87+
"airflow": "airflow",
88+
"apache airflow": "airflow",
8289
}
8390

8491

@@ -558,6 +565,30 @@ def _classify_service_instance(
558565
}, "rabbitmq"
559566
return None, None
560567

568+
if key == "airflow":
569+
try:
570+
airflow_config = build_airflow_config(
571+
{
572+
"base_url": credentials.get("base_url", DEFAULT_AIRFLOW_BASE_URL),
573+
"username": credentials.get("username", ""),
574+
"password": credentials.get("password", ""),
575+
"auth_token": credentials.get("auth_token", ""),
576+
"timeout_seconds": credentials.get("timeout_seconds", 15.0),
577+
"verify_ssl": credentials.get("verify_ssl", True),
578+
"max_results": credentials.get("max_results", 50),
579+
}
580+
)
581+
except Exception:
582+
return None, None
583+
584+
if airflow_config.is_configured:
585+
return {
586+
**airflow_config.model_dump(),
587+
"integration_id": record_id,
588+
}, "airflow"
589+
590+
return None, None
591+
561592
if key == "azure_sql":
562593
try:
563594
azure_sql_config = build_azure_sql_config(
@@ -1087,6 +1118,17 @@ def load_env_integrations() -> list[dict[str, Any]]:
10871118
}
10881119
)
10891120

1121+
airflow_config = airflow_config_from_env()
1122+
if airflow_config is not None:
1123+
integrations.append(
1124+
{
1125+
"id": "env-airflow",
1126+
"service": "airflow",
1127+
"status": "active",
1128+
"credentials": airflow_config.model_dump(exclude={"integration_id"}),
1129+
}
1130+
)
1131+
10901132
atlas_pub = os.getenv("MONGODB_ATLAS_PUBLIC_KEY", "").strip()
10911133
atlas_priv = os.getenv("MONGODB_ATLAS_PRIVATE_KEY", "").strip()
10921134
atlas_project = os.getenv("MONGODB_ATLAS_PROJECT_ID", "").strip()

0 commit comments

Comments
 (0)