Skip to content

Commit

Permalink
Passing the correct 'anonymous_warehouse_id'.
Browse files Browse the repository at this point in the history
  • Loading branch information
elongl committed Jun 21, 2023
1 parent abbfdf5 commit c1875c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 3 additions & 5 deletions elementary/monitor/data_monitoring/data_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ def __init__(
latest_invocation = self.get_latest_invocation()
self.project_name = latest_invocation.get("project_name")
dbt_pkg_version = latest_invocation.get("elementary_version")
warehouse_info = self._get_warehouse_info(
self.warehouse_info = self._get_warehouse_info(
hash_id=isinstance(tracking, AnonymousTracking)
)
if warehouse_info:
self.warehouse_type = warehouse_info.type
if tracking:
if warehouse_info:
tracking.register_warehouse_group(warehouse_info)
if self.warehouse_info:
tracking.register_warehouse_group(self.warehouse_info)
tracking.set_env("target_name", latest_invocation.get("target_name"))
tracking.set_env("dbt_orchestrator", latest_invocation.get("orchestrator"))
tracking.set_env("dbt_version", latest_invocation.get("dbt_version"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def get_report_data(
project_name=project_name or self.project_name,
filter=self.filter.get_filter(),
env=self.config.env,
warehouse_type=self.warehouse_type,
warehouse_type=self.warehouse_info.type if self.warehouse_info else None,
)
self._add_report_tracking(report_data, error)
if error:
Expand Down Expand Up @@ -148,7 +148,9 @@ def _add_report_tracking(
report_data.tracking = dict(
posthog_api_key=self.tracking.POSTHOG_PROJECT_API_KEY,
report_generator_anonymous_user_id=self.tracking.anonymous_user_id,
anonymous_warehouse_id=self.tracking.anonymous_warehouse_id,
anonymous_warehouse_id=self.warehouse_info.id
if self.warehouse_info
else None,
)

def send_report(
Expand Down
1 change: 0 additions & 1 deletion elementary/tracking/anonymous_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class AnonymousTracking(Tracking):
def __init__(self, config: Config) -> None:
super().__init__(config)
self.anonymous_user_id = None
self.anonymous_warehouse_id = None
self._do_not_track = config.anonymous_tracking_enabled is False
self._run_id = str(uuid.uuid4())

Expand Down

0 comments on commit c1875c3

Please sign in to comment.