Skip to content

Commit

Permalink
Change type to event_type
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajastro committed Dec 3, 2024
1 parent 4b5e650 commit bc1578d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dagfactory/constants.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion dagfactory/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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"},
}

0 comments on commit bc1578d

Please sign in to comment.