Skip to content

Commit

Permalink
ref(dx): Only show the analytics notice once (#56757)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
evanpurkhiser authored and RaduW committed Sep 25, 2023
1 parent 8e9ff79 commit 6c42c80
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/sentry/runner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 6c42c80

Please sign in to comment.