From 0b31a7692d99adab5afced1058dac4acf6738a8f Mon Sep 17 00:00:00 2001 From: Evan Purkhiser Date: Fri, 22 Sep 2023 14:18:43 -0700 Subject: [PATCH] ref(dx): Only show the analytics notice once (#56757) Every run of a sentry command greets you with ``` INFO:The Sentry runner will report development issues to Sentry.io. Use SENTRY_DEVENV_NO_REPORT to avoid reporting issues. ``` I don't think we need to see this more than once :-) This is take two of GH-56752, the mode needed to be `w+` to create the file --- src/sentry/runner/__init__.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/sentry/runner/__init__.py b/src/sentry/runner/__init__.py index 5e5b7012ef98a..ca35613dbccfe 100644 --- a/src/sentry/runner/__init__.py +++ b/src/sentry/runner/__init__.py @@ -7,6 +7,7 @@ import sentry_sdk import sentry +from sentry.runner.settings import get_sentry_conf from sentry.utils.imports import import_string # We need to run this here because of a concurrency bug in Python's locale @@ -175,10 +176,16 @@ def main(): logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.INFO) logger = logging.getLogger(__name__) - logger.info( - "The Sentry runner will report development issues to Sentry.io. " - "Use SENTRY_DEVENV_NO_REPORT to avoid reporting issues." - ) + # Only show analytics notice once + analytics_seen_file = os.path.join(get_sentry_conf(), "dev-analytics-notice-seen") + if not os.path.isfile(analytics_seen_file): + logger.info( + "The Sentry runner will report development issues to Sentry.io. " + "Use SENTRY_DEVENV_NO_REPORT to avoid reporting issues." + ) + with open(analytics_seen_file, "w+") as file: + file.write("# This is an autogenerated file from the sentry command runner") + try: func(**kwargs) except Exception as e: