From c0ba47b81388605ba9da6e447f0aee355318664b Mon Sep 17 00:00:00 2001 From: Morgan Wowk Date: Fri, 8 May 2026 13:34:07 -0700 Subject: [PATCH] Wire Bugsnag into the orchestrator --- cloud_pipelines_backend/orchestrator_sql.py | 2 ++ orchestrator_main.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cloud_pipelines_backend/orchestrator_sql.py b/cloud_pipelines_backend/orchestrator_sql.py index 3694873..ed402ec 100644 --- a/cloud_pipelines_backend/orchestrator_sql.py +++ b/cloud_pipelines_backend/orchestrator_sql.py @@ -21,6 +21,7 @@ from . import component_structures as structures from .launchers import common_annotations from .launchers import interfaces as launcher_interfaces +from .instrumentation import bugsnag_instrumentation from .instrumentation import contextual_logging from .instrumentation import metrics as app_metrics @@ -1055,6 +1056,7 @@ def _retry( def record_system_error_exception(execution: bts.ExecutionNode, exception: Exception): app_metrics.execution_system_errors.add(1) + bugsnag_instrumentation.notify(exception=exception, execution_id=str(execution.id)) if execution.extra_data is None: execution.extra_data = {} diff --git a/orchestrator_main.py b/orchestrator_main.py index 99b7e8f..7c7c23d 100644 --- a/orchestrator_main.py +++ b/orchestrator_main.py @@ -6,6 +6,7 @@ from sqlalchemy import orm from cloud_pipelines_backend import orchestrator_sql +from cloud_pipelines_backend.instrumentation import bugsnag_instrumentation from cloud_pipelines_backend.launchers import kubernetes_launchers from cloud_pipelines.orchestration.storage_providers import local_storage @@ -32,6 +33,7 @@ def main(): logger.addHandler(stderr_handler) logger.info("Starting the orchestrator") + bugsnag_instrumentation.setup(service_name="tangle-orchestrator") DEFAULT_DATABASE_URI = "sqlite:///db.sqlite" database_uri = os.environ.get("DATABASE_URI", DEFAULT_DATABASE_URI) @@ -77,7 +79,11 @@ def main(): default_task_annotations=default_task_annotations, sleep_seconds_between_queue_sweeps=5.0, ) - orchestrator.run_loop() + try: + orchestrator.run_loop() + except Exception as exc: + bugsnag_instrumentation.notify(exception=exc) + raise if __name__ == "__main__":