Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix conflict for real not minimal snowplow tracker #8680

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions core/dbt/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from dbt import version as dbt_version
from dbt import flags
from snowplow_tracker import Subject, Tracker, Emitter, logger as sp_logger
from snowplow_tracker import __version__ as snowplow_version # type: ignore
from snowplow_tracker import SelfDescribingJson
from datetime import datetime

Expand Down Expand Up @@ -48,17 +49,20 @@
RUNNABLE_TIMING = "iglu:com.dbt/runnable/jsonschema/1-0-0"
DBT_INVOCATION_ENV = "DBT_INVOCATION_ENV"

# workaround in case real snowplow tracker is in the env
INIT_KW_ARGS = {"buffer_size": 30} if snowplow_version == "0.0.2" else {"batch_size": 30}


class TimeoutEmitter(Emitter):
def __init__(self):
super().__init__(
COLLECTOR_URL,
protocol=COLLECTOR_PROTOCOL,
buffer_size=30,
on_failure=self.handle_failure,
method="post",
# don't set this.
byte_limit=None,
**INIT_KW_ARGS,
)

@staticmethod
Expand Down Expand Up @@ -102,11 +106,20 @@ def http_get(self, payload):


emitter = TimeoutEmitter()
tracker = Tracker(
emitter,
namespace="cf",
app_id="dbt",
)

# workaround in case real snowplow tracker is in the env
if snowplow_version == "0.0.2":
tracker = Tracker(
emitter,
namespace="cf",
app_id="dbt",
)
else:
tracker = Tracker(
"cf",
emitters=emitter,
app_id="dbt",
) # type: ignore


class User:
Expand Down