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

remove run_error from tracking code #817

Merged
merged 5 commits into from
Jul 6, 2018
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Write JSON manifest file to disk during compilation ([#761](https://github.com/fishtown-analytics/dbt/pull/761))
- Add forward and backward graph edges to the JSON manifest file ([#762](https://github.com/fishtown-analytics/dbt/pull/762))
- Add a 'dbt docs generate' command to generate a JSON catalog file ([#774](https://github.com/fishtown-analytics/dbt/pull/774))
- Stop tracking `run_error` in tracking code ([#817](https://github.com/fishtown-analytics/dbt/pull/817))

## dbt 0.10.1 (May 18, 2018)

Expand Down
15 changes: 6 additions & 9 deletions dbt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,17 @@ def run_from_task(task, proj, parsed_args):
try:
result = task.run()
dbt.tracking.track_invocation_end(
project=proj, args=parsed_args, result_type="ok", result=None
project=proj, args=parsed_args, result_type="ok"
)
except (dbt.exceptions.NotImplementedException,
dbt.exceptions.FailedToConnectException) as e:
logger.info('ERROR: {}'.format(e))
dbt.tracking.track_invocation_end(
project=proj, args=parsed_args, result_type="error", result=str(e)
project=proj, args=parsed_args, result_type="error"
)
except Exception as e:
dbt.tracking.track_invocation_end(
project=proj, args=parsed_args, result_type="error", result=str(e)
project=proj, args=parsed_args, result_type="error"
)
raise

Expand Down Expand Up @@ -196,8 +196,7 @@ def invoke_dbt(parsed):
dbt.tracking.track_invalid_invocation(
project=proj,
args=parsed,
result_type="invalid_profile",
result=str(e))
result_type="invalid_profile")

return None
except project.DbtProfileError as e:
Expand All @@ -207,8 +206,7 @@ def invoke_dbt(parsed):
dbt.tracking.track_invalid_invocation(
project=proj,
args=parsed,
result_type="invalid_profile",
result=str(e))
result_type="invalid_profile")

return None

Expand All @@ -228,8 +226,7 @@ def invoke_dbt(parsed):
dbt.tracking.track_invalid_invocation(
project=proj,
args=parsed,
result_type="invalid_target",
result="target not found")
result_type="invalid_target")

return None

Expand Down
2 changes: 1 addition & 1 deletion dbt/node_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def track_model_run(index, num_nodes, run_model_result):
"execution_time": run_model_result.execution_time,
"run_status": run_model_result.status,
"run_skipped": run_model_result.skip,
"run_error": run_model_result.error,
"run_error": None,
"model_materialization": dbt.utils.get_materialization(run_model_result.node), # noqa
"model_id": dbt.utils.get_hash(run_model_result.node),
"hashed_contents": dbt.utils.get_hashed_contents(run_model_result.node), # noqa
Expand Down
51 changes: 24 additions & 27 deletions dbt/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import uuid
import yaml
import os
import json
import logging

import dbt.clients.system

Expand Down Expand Up @@ -78,7 +76,7 @@ def get_cookie(self):
user = yaml.safe_load(fh)
if user is None:
user = self.set_cookie()
except yaml.reader.ReaderError as e:
except yaml.reader.ReaderError:
user = self.set_cookie()
return user

Expand All @@ -89,15 +87,15 @@ def get_run_type(args):

def get_invocation_context(user, project, args):
return {
"project_id": None if project is None else project.hashed_name(),
"user_id": user.id,
"invocation_id": user.invocation_id,
"project_id": None if project is None else project.hashed_name(),
"user_id": user.id,
"invocation_id": user.invocation_id,

"command": args.which,
"options": None,
"version": dbt_version.installed,
"command": args.which,
"options": None,
"version": str(dbt_version.installed),

"run_type": get_run_type(args),
"run_type": get_run_type(args),
}


Expand All @@ -114,26 +112,26 @@ def get_invocation_start_context(user, project, args):
return SelfDescribingJson(INVOCATION_SPEC, data)


def get_invocation_end_context(user, project, args, result_type, result):
def get_invocation_end_context(user, project, args, result_type):
data = get_invocation_context(user, project, args)

start_data = {
"progress": "end",
"result_type": result_type,
"result": result,
"result": None
}

data.update(start_data)
return SelfDescribingJson(INVOCATION_SPEC, data)


def get_invocation_invalid_context(user, project, args, result_type, result):
def get_invocation_invalid_context(user, project, args, result_type):
data = get_invocation_context(user, project, args)

start_data = {
"progress": "invalid",
"result_type": result_type,
"result": result,
"result": None
}

data.update(start_data)
Expand Down Expand Up @@ -171,17 +169,17 @@ def track(user, *args, **kwargs):
logger.debug("Sending event: {}".format(kwargs))
try:
tracker.track_struct_event(*args, **kwargs)
except Exception as e:
except Exception:
logger.debug(
"An error was encountered while trying to send an event"
)


def track_invocation_start(project=None, args=None):
context = [
get_invocation_start_context(active_user, project, args),
get_platform_context(),
get_dbt_env_context()
get_invocation_start_context(active_user, project, args),
get_platform_context(),
get_dbt_env_context()
]

track(
Expand All @@ -195,7 +193,7 @@ def track_invocation_start(project=None, args=None):

def track_model_run(options):
context = [SelfDescribingJson(RUN_MODEL_SPEC, options)]
model_id = options['model_id']

track(
active_user,
category="dbt",
Expand All @@ -218,11 +216,11 @@ def track_package_install(options):


def track_invocation_end(
project=None, args=None, result_type=None, result=None
project=None, args=None, result_type=None
):
user = active_user
context = [
get_invocation_end_context(user, project, args, result_type, result),
get_invocation_end_context(user, project, args, result_type),
get_platform_context(),
get_dbt_env_context()
]
Expand All @@ -236,16 +234,15 @@ def track_invocation_end(


def track_invalid_invocation(
project=None, args=None, result_type=None, result=None
project=None, args=None, result_type=None
):

user = active_user
invocation_context = get_invocation_invalid_context(
user,
project,
args,
result_type,
result
user,
project,
args,
result_type
)

context = [
Expand Down