Initialize Sentry crash reporting. Returns True if initialized.
(**init_overrides: Any)
| 57 | |
| 58 | |
| 59 | def initialize_telemetry(**init_overrides: Any) -> bool: |
| 60 | """Initialize Sentry crash reporting. Returns True if initialized.""" |
| 61 | if not telemetry_enabled(): |
| 62 | return False |
| 63 | |
| 64 | try: |
| 65 | init_kwargs: dict[str, Any] = dict( |
| 66 | dsn=SENTRY_DSN, |
| 67 | release=system_config.client_version, |
| 68 | environment=os.environ.get(ENVIRONMENT_ENV_VAR, DEFAULT_ENVIRONMENT), |
| 69 | send_default_pii=False, |
| 70 | server_name="", # hostname is identifying; don't send it |
| 71 | default_integrations=False, |
| 72 | auto_enabling_integrations=False, |
| 73 | integrations=[ |
| 74 | AtexitIntegration(callback=lambda pending, timeout: None), |
| 75 | DedupeIntegration(), |
| 76 | ModulesIntegration(), |
| 77 | ], |
| 78 | include_local_variables=True, |
| 79 | event_scrubber=EventScrubber(denylist=SCRUB_DENYLIST, recursive=True), |
| 80 | shutdown_timeout=FLUSH_TIMEOUT_SECONDS, |
| 81 | ) |
| 82 | init_kwargs.update(init_overrides) |
| 83 | sentry_sdk.init(**init_kwargs) |
| 84 | return True |
| 85 | except Exception: |
| 86 | return False |
| 87 | |
| 88 | |
| 89 | def capture_crash(exc_info, run_state: Optional[RunState], args) -> bool: |