enable / disable logic update
This commit is contained in:
@@ -23,17 +23,16 @@ POSTHOG_WRITE_KEY = "phc_1kUR0o04oJKKTTeSsIz2Mfm5mpiVsQEf2WOlzljMD7y"
|
|||||||
OPT_IN_WARNING_SLEEP_SECONDS = 15
|
OPT_IN_WARNING_SLEEP_SECONDS = 15
|
||||||
OPT_IN_INFO = (
|
OPT_IN_INFO = (
|
||||||
"\nTelemetry is currently disabled by default. If you'd like to help improve "
|
"\nTelemetry is currently disabled by default. If you'd like to help improve "
|
||||||
"Axolotl, consider enabling it by setting:\n"
|
"Axolotl, consider enabling it by setting AXOLOTL_DO_NOT_TRACK=0 in your environment.\n\n"
|
||||||
"AXOLOTL_DO_NOT_TRACK=0\n\n"
|
|
||||||
"Telemetry data helps us understand:\n"
|
"Telemetry data helps us understand:\n"
|
||||||
"- Which features are most used\n"
|
"- Which features are most used\n"
|
||||||
"- What hardware configurations to prioritize\n"
|
"- What hardware configurations to prioritize\n"
|
||||||
"- Where users encounter errors\n\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) "
|
"To remove this warning, explicitly set AXOLOTL_DO_NOT_TRACK=0 (enable telemetry) "
|
||||||
"or AXOLOTL_DO_NOT_TRACK=1 (explicitly disable telemetry).\n\n"
|
"or AXOLOTL_DO_NOT_TRACK=1 (explicitly disable telemetry).\n\n"
|
||||||
"NOTE: Telemetry will move to an opt-out in a later release.\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"
|
"For details, see: https://axolotl-ai-cloud.github.io/axolotl/docs/telemetry.html\n\n"
|
||||||
f"Sleeping for {OPT_IN_WARNING_SLEEP_SECONDS}s..."
|
f"Sleeping for {OPT_IN_WARNING_SLEEP_SECONDS}s..."
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -180,7 +179,12 @@ class TelemetryManager:
|
|||||||
do_not_track = os.getenv("DO_NOT_TRACK")
|
do_not_track = os.getenv("DO_NOT_TRACK")
|
||||||
|
|
||||||
# Default to disabled (opt-in model for initial release)
|
# 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
|
# Print opt-in info message for main process only
|
||||||
if is_main_process():
|
if is_main_process():
|
||||||
LOG.info(OPT_IN_INFO)
|
LOG.info(OPT_IN_INFO)
|
||||||
@@ -188,6 +192,10 @@ class TelemetryManager:
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Only rank 0 will send telemetry
|
||||||
|
if not is_main_process():
|
||||||
|
return False
|
||||||
|
|
||||||
if do_not_track is None:
|
if do_not_track is None:
|
||||||
do_not_track = "0"
|
do_not_track = "0"
|
||||||
|
|
||||||
@@ -197,10 +205,6 @@ class TelemetryManager:
|
|||||||
"true",
|
"true",
|
||||||
) and do_not_track.lower() not in ("1", "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
|
return enabled
|
||||||
|
|
||||||
def _load_whitelist(self) -> dict:
|
def _load_whitelist(self) -> dict:
|
||||||
|
|||||||
Reference in New Issue
Block a user