Skip to content

Commit

Permalink
Allow a null user, but don't send tracking info
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Wigley committed Jul 21, 2021
1 parent 8b4b518 commit cdee6ff
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions core/dbt/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def get_dbt_env_context():


def track(user, *args, **kwargs):
if user.do_not_track:
if user is None or user.do_not_track:
return
else:
logger.debug("Sending event: {}".format(kwargs))
Expand Down Expand Up @@ -278,8 +278,6 @@ def track_invocation_start(config=None, args=None):

def track_project_load(options):
context = [SelfDescribingJson(LOAD_ALL_TIMING_SPEC, options)]
assert active_user is not None, \
'Cannot track project loading time when active user is None'

track(
active_user,
Expand All @@ -292,8 +290,6 @@ def track_project_load(options):

def track_resource_counts(resource_counts):
context = [SelfDescribingJson(RESOURCE_COUNTS, resource_counts)]
assert active_user is not None, \
'Cannot track resource counts when active user is None'

track(
active_user,
Expand All @@ -306,8 +302,6 @@ def track_resource_counts(resource_counts):

def track_model_run(options):
context = [SelfDescribingJson(RUN_MODEL_SPEC, options)]
assert active_user is not None, \
'Cannot track model runs when active user is None'

track(
active_user,
Expand All @@ -320,8 +314,6 @@ def track_model_run(options):

def track_rpc_request(options):
context = [SelfDescribingJson(RPC_REQUEST_SPEC, options)]
assert active_user is not None, \
'Cannot track rpc requests when active user is None'

track(
active_user,
Expand All @@ -333,9 +325,6 @@ def track_rpc_request(options):


def track_package_install(config, args, options):
assert active_user is not None, \
'Cannot track package installs when active user is None'

invocation_data = get_invocation_context(active_user, config, args)

context = [
Expand All @@ -354,10 +343,6 @@ def track_package_install(config, args, options):


def track_deprecation_warn(options):

assert active_user is not None, \
'Cannot track deprecation warnings when active user is None'

context = [
SelfDescribingJson(DEPRECATION_WARN_SPEC, options)
]
Expand All @@ -382,9 +367,6 @@ def track_invocation_end(
get_dbt_env_context()
]

assert active_user is not None, \
'Cannot track invocation end when active user is None'

track(
active_user,
category="dbt",
Expand All @@ -397,9 +379,6 @@ def track_invocation_end(
def track_invalid_invocation(
config=None, args=None, result_type=None
):
assert active_user is not None, \
'Cannot track invalid invocations when active user is None'

user = active_user
invocation_context = get_invocation_invalid_context(
user,
Expand All @@ -425,9 +404,6 @@ def track_invalid_invocation(

def track_experimental_parser_sample(options):
context = [SelfDescribingJson(EXPERIMENTAL_PARSER, options)]
assert active_user is not None, \
'Cannot track project loading time when active user is None'

track(
active_user,
category='dbt',
Expand Down

0 comments on commit cdee6ff

Please sign in to comment.