From ea4f0efe3da6ecf3d0f0b24a86ecd97554205560 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Wed, 18 Sep 2024 14:26:11 -0400 Subject: [PATCH] snowplow is deprecating track_struct_event; use StructuredEvent instead --- core/dbt/tracking.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/dbt/tracking.py b/core/dbt/tracking.py index 880243e4d6e..eeb0a3d4551 100644 --- a/core/dbt/tracking.py +++ b/core/dbt/tracking.py @@ -12,6 +12,7 @@ from snowplow_tracker import Emitter, SelfDescribingJson, Subject, Tracker from snowplow_tracker import __version__ as snowplow_version # type: ignore from snowplow_tracker import logger as sp_logger +from snowplow_tracker.events import StructuredEvent from dbt import version as dbt_version from dbt.adapters.exceptions import FailedToConnectError @@ -215,12 +216,12 @@ def get_dbt_env_context(): def track(user, *args, **kwargs): if user.do_not_track: return - else: - fire_event(SendingEvent(kwargs=str(kwargs))) - try: - tracker.track_struct_event(*args, **kwargs) - except Exception: - fire_event(SendEventFailure()) + + fire_event(SendingEvent(kwargs=str(kwargs))) + try: + tracker.track(StructuredEvent(*args, **kwargs)) + except Exception: + fire_event(SendEventFailure()) def track_project_id(options):