From bc1578d95334b9ed42d5fad9f421266862ad2b42 Mon Sep 17 00:00:00 2001 From: pankajastro Date: Tue, 3 Dec 2024 18:02:00 +0530 Subject: [PATCH] Change type to event_type --- dagfactory/constants.py | 2 +- dagfactory/telemetry.py | 2 +- tests/test_telemetry.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dagfactory/constants.py b/dagfactory/constants.py index 972aea2..4ca9f26 100644 --- a/dagfactory/constants.py +++ b/dagfactory/constants.py @@ -1,3 +1,3 @@ -TELEMETRY_URL = "https://astronomer.gateway.scarf.sh/dag-factory/{telemetry_version}/{dagfactory_version}/{airflow_version}/{python_version}/{platform_system}/{platform_machine}/{type}/{status}/{dag_hash}/{task_count}" +TELEMETRY_URL = "https://astronomer.gateway.scarf.sh/dag-factory/{telemetry_version}/{dagfactory_version}/{airflow_version}/{python_version}/{platform_system}/{platform_machine}/{event_type}/{status}/{dag_hash}/{task_count}" TELEMETRY_VERSION = "v2" TELEMETRY_TIMEOUT = 5.0 diff --git a/dagfactory/telemetry.py b/dagfactory/telemetry.py index 44412cc..9a2f058 100644 --- a/dagfactory/telemetry.py +++ b/dagfactory/telemetry.py @@ -65,7 +65,7 @@ def emit_usage_metrics_if_enabled(event_type: str, additional_metrics: dict[str, """ if should_emit(): metrics = collect_standard_usage_metrics() - metrics["type"] = event_type + metrics["event_type"] = event_type metrics["variables"].update(additional_metrics) metrics.update(additional_metrics) is_success = emit_usage_metrics(metrics) diff --git a/tests/test_telemetry.py b/tests/test_telemetry.py index 35da5fa..ec58f0f 100644 --- a/tests/test_telemetry.py +++ b/tests/test_telemetry.py @@ -52,7 +52,7 @@ def test_emit_usage_metrics_fails(mock_httpx_get, caplog): "python_version": "3.11", "platform_system": "darwin", "platform_machine": "amd64", - "type": "dag_run", + "event_type": "dag_run", "status": "success", "dag_hash": "d151d1fa2f03270ea116cc7494f2c591", "task_count": 3, @@ -79,7 +79,7 @@ def test_emit_usage_metrics_succeeds(caplog): "python_version": "3.11", "platform_system": "darwin", "platform_machine": "amd64", - "type": "dag_run", + "event_type": "dag_run", "status": "success", "dag_hash": "d151d1fa2f03270ea116cc7494f2c591", "task_count": 3, @@ -109,6 +109,6 @@ def test_emit_usage_metrics_if_enabled_succeeds( assert mock_emit_usage_metrics.call_args.args[0] == { "k1": "v1", "k2": "v2", - "type": "any", + "event_type": "any", "variables": {"k2": "v2"}, }