Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 831ecbb

Browse files
authored
Merge pull request #847 from datafold/send_event_json_errors
Send event json errors
2 parents e305480 + ca0ec8f commit 831ecbb

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

data_diff/diff_tables.py

+2
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ def diff_tables(self, table1: TableSegment, table2: TableSegment, info_tree: Inf
213213
def _diff_tables_wrapper(self, table1: TableSegment, table2: TableSegment, info_tree: InfoTree) -> DiffResult:
214214
if is_tracking_enabled():
215215
options = attrs.asdict(self, recurse=False)
216+
# not a useful event attribute
217+
options.pop("_ignored_columns_lock")
216218
options["differ_name"] = type(self).__name__
217219
event_json = create_start_event_json(options)
218220
run_as_daemon(send_event_json, event_json)

data_diff/tracking.py

+17
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,27 @@ def create_email_signup_event_json(email: str) -> Dict[str, Any]:
201201
}
202202

203203

204+
def convert_sets_to_lists(obj):
205+
"""
206+
Recursively convert sets in the given object to lists.
207+
"""
208+
if isinstance(obj, set):
209+
return list(obj)
210+
elif isinstance(obj, dict):
211+
return {k: convert_sets_to_lists(v) for k, v in obj.items()}
212+
elif isinstance(obj, list):
213+
return [convert_sets_to_lists(elem) for elem in obj]
214+
else:
215+
return obj
216+
217+
204218
def send_event_json(event_json) -> None:
205219
if not g_tracking_enabled:
206220
raise RuntimeError("Won't send; tracking is disabled!")
207221

222+
# Convert sets to lists in event_json
223+
event_json = convert_sets_to_lists(event_json)
224+
208225
headers = {
209226
"Content-Type": "application/json",
210227
"Authorization": "Basic MkhndE00SGNxOUJtZWlDcU5ZaHo3Tzl0a2pNOg==",

0 commit comments

Comments
 (0)