Skip to content

Commit

Permalink
enable / disable logic update
Browse files Browse the repository at this point in the history
  • Loading branch information
djsaunde committed Feb 26, 2025
1 parent 0f15aa9 commit 844bbba
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/axolotl/telemetry/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@
OPT_IN_WARNING_SLEEP_SECONDS = 15
OPT_IN_INFO = (
"\nTelemetry is currently disabled by default. If you'd like to help improve "
"Axolotl, consider enabling it by setting:\n"
"AXOLOTL_DO_NOT_TRACK=0\n\n"
"Axolotl, consider enabling it by setting AXOLOTL_DO_NOT_TRACK=0 in your environment.\n\n"
"Telemetry data helps us understand:\n"
"- Which features are most used\n"
"- What hardware configurations to prioritize\n"
"- Where users encounter errors\n\n"
"No personally identifiable information is collected.\n"
"No personally identifiable information is collected.\n\n"
"To remove this warning, explicitly set AXOLOTL_DO_NOT_TRACK=0 (enable telemetry) "
"or AXOLOTL_DO_NOT_TRACK=1 (explicitly disable telemetry).\n\n"
"NOTE: Telemetry will move to an opt-out in a later release.\n"
"For details, see: https://axolotl-ai-cloud.github.io/axolotl/docs/telemetry.html\n"
"Note: Telemetry will move to an opt-out in a later release.\n\n"
"For details, see: https://axolotl-ai-cloud.github.io/axolotl/docs/telemetry.html\n\n"
f"Sleeping for {OPT_IN_WARNING_SLEEP_SECONDS}s..."
)

Expand Down Expand Up @@ -180,14 +179,23 @@ def _check_telemetry_enabled(self) -> bool:
do_not_track = os.getenv("DO_NOT_TRACK")

# Default to disabled (opt-in model for initial release)
if axolotl_do_not_track is None:
if axolotl_do_not_track is None or axolotl_do_not_track.lower() not in (
"0",
"1",
"false",
"true",
):
# Print opt-in info message for main process only
if is_main_process():
LOG.info(OPT_IN_INFO)
time.sleep(OPT_IN_WARNING_SLEEP_SECONDS)

return False

# Only rank 0 will send telemetry
if not is_main_process():
return False

if do_not_track is None:
do_not_track = "0"

Expand All @@ -197,10 +205,6 @@ def _check_telemetry_enabled(self) -> bool:
"true",
) and do_not_track.lower() not in ("1", "true")

# Only rank 0 will send telemetry
if not is_main_process():
return False

return enabled

def _load_whitelist(self) -> dict:
Expand Down

0 comments on commit 844bbba

Please sign in to comment.