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

Commit 8560a6a

Browse files
committed
add usage type tracking
1 parent d01e74b commit 8560a6a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

data_diff/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .databases import connect
2121
from .parse_time import parse_time_before, UNITS_STR, ParseError
2222
from .config import apply_config_from_file
23-
from .tracking import disable_tracking
23+
from .tracking import disable_tracking, set_entrypoint_name
2424
from .version import __version__
2525

2626

@@ -32,6 +32,7 @@
3232
"-": "red",
3333
}
3434

35+
set_entrypoint_name("CLI")
3536

3637
def _remove_passwords_in_dict(d: dict):
3738
for k, v in d.items():

data_diff/tracking.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def _load_profile():
4040
g_tracking_enabled = True
4141
g_anonymous_id = None
4242

43+
entrypoint_name = "Python API"
44+
4345

4446
def disable_tracking():
4547
global g_tracking_enabled
@@ -50,6 +52,11 @@ def is_tracking_enabled():
5052
return g_tracking_enabled
5153

5254

55+
def set_entrypoint_name(s):
56+
global entrypoint_name
57+
entrypoint_name = s
58+
59+
5360
def get_anonymous_id():
5461
global g_anonymous_id
5562
if g_anonymous_id is None:
@@ -70,6 +77,7 @@ def create_start_event_json(diff_options: Dict[str, Any]):
7077
"python_version": f"{platform.python_version()}/{platform.python_implementation()}",
7178
"diff_options": diff_options,
7279
"data_diff_version:": __version__,
80+
"entrypoint_name": entrypoint_name,
7381
},
7482
}
7583

@@ -99,6 +107,7 @@ def create_end_event_json(
99107
"diff_rows_cnt": diff_count,
100108
"error_message": error,
101109
"data_diff_version:": __version__,
110+
"entrypoint_name": entrypoint_name,
102111
},
103112
}
104113

0 commit comments

Comments
 (0)