From aaa19dae1eb7f592ff3e43cd5bb75ef2e27db748 Mon Sep 17 00:00:00 2001 From: Tatiana Al-Chueyr Date: Fri, 20 Dec 2024 05:44:56 +0000 Subject: [PATCH] Change log levels to analyse behaviour in Astro CLI --- cosmos/listeners/dag_run_listener.py | 4 ---- cosmos/telemetry.py | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cosmos/listeners/dag_run_listener.py b/cosmos/listeners/dag_run_listener.py index 7af936b04..62328de3c 100644 --- a/cosmos/listeners/dag_run_listener.py +++ b/cosmos/listeners/dag_run_listener.py @@ -1,7 +1,5 @@ from __future__ import annotations -import functools - from airflow.listeners import hookimpl from airflow.models.dag import DAG from airflow.models.dagrun import DagRun @@ -27,7 +25,6 @@ def is_cosmos_dag(dag: DAG) -> bool: def total_cosmos_task_groups(dag: DAG) -> int: - cosmos_task_groups = 0 for group_id, task_group in dag.task_group_dict.items(): if task_group.__class__.__module__.startswith("cosmos."): @@ -45,7 +42,6 @@ def total_cosmos_tasks(dag: DAG) -> int: return cosmos_tasks -@functools.lru_cache() def uses_cosmos(dag: DAG) -> bool: return bool(is_cosmos_dag(dag) or total_cosmos_task_groups(dag) or total_cosmos_tasks(dag)) diff --git a/cosmos/telemetry.py b/cosmos/telemetry.py index 4b5dd4abc..6ae452023 100644 --- a/cosmos/telemetry.py +++ b/cosmos/telemetry.py @@ -44,7 +44,7 @@ def emit_usage_metrics(metrics: dict[str, object]) -> bool: telemetry_url = constants.TELEMETRY_URL.format( **metrics, telemetry_version=constants.TELEMETRY_VERSION, query_string=query_string ) - logging.debug("Telemetry is enabled. Emitting the following usage metrics to %s: %s", telemetry_url, metrics) + logging.info("Telemetry is enabled. Emitting the following usage metrics to %s: %s", telemetry_url, metrics) response = httpx.get(telemetry_url, timeout=constants.TELEMETRY_TIMEOUT, follow_redirects=True) if not response.is_success: logging.warning( @@ -71,5 +71,5 @@ def emit_usage_metrics_if_enabled(event_type: str, additional_metrics: dict[str, is_success = emit_usage_metrics(metrics) return is_success else: - logging.debug("Telemetry is disabled. To enable it, export AIRFLOW__COSMOS__ENABLE_TELEMETRY=True.") + logging.info("Telemetry is disabled. To enable it, export AIRFLOW__COSMOS__ENABLE_TELEMETRY=True.") return False